|
|
Choosing A Webhost: |
svn commit: r219009 - in /lenya/trunk/src/webapp/lenya/pubs/default/java/sr: msg#00062cms.lenya.cvs
Author: andreas Date: Thu Jul 14 01:06:45 2005 New Revision: 219009 URL: http://svn.apache.org/viewcvs?rev=219009&view=rev Log: [minor change] code formatting Modified: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/FilePropfind.java lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Propfind.java lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Put.java Modified: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/FilePropfind.java URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/FilePropfind.java?rev=219009&r1=219008&r2=219009&view=diff ============================================================================== --- lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/FilePropfind.java (original) +++ lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/FilePropfind.java Thu Jul 14 01:06:45 2005 @@ -41,10 +41,10 @@ */ public class FilePropfind extends SiteUsecase { - protected static final String DOCUMENT = "document"; - protected static final String DOCUMENTS = "documents"; + protected static final String DOCUMENT = "document"; + protected static final String DOCUMENTS = "documents"; protected static final String SOURCEURL = "sourceURL"; - protected static final String DATEFORMAT = "dateFormat"; + protected static final String DATEFORMAT = "dateFormat"; protected static final String RC = "rc"; /** @@ -60,11 +60,11 @@ DocumentBuilder docBuilder = null; Vector docs = new Vector(); Vector checkedOut = new Vector(); - + String request = getSourceURL(); try { - //get Parameters for RC + // get Parameters for RC String publicationPath = _publication.getDirectory().getCanonicalPath(); RCEnvironment rcEnvironment = RCEnvironment.getInstance(_publication.getServletContext() .getCanonicalPath()); @@ -74,22 +74,24 @@ backupDirectory = publicationPath + File.separator + backupDirectory; // Initialize Revision Controller - RevisionController rc = new RevisionController(rcmlDirectory, backupDirectory, publicationPath); - - Document doc = getTargetDocument(false); + RevisionController rc = new RevisionController(rcmlDirectory, + backupDirectory, + publicationPath); + + Document doc = getTargetDocument(false); docs.add(doc); - + String filename = doc.getFile().getCanonicalPath(); filename = filename.substring(publicationPath.length()); - RCMLEntry entry = rc.getRCML(filename).getLatestEntry(); - if ((entry != null) && (entry.getType() == RCML.co) ) - checkedOut.add(entry); - else - checkedOut.add(null); + RCMLEntry entry = rc.getRCML(filename).getLatestEntry(); + if ((entry != null) && (entry.getType() == RCML.co)) + checkedOut.add(entry); + else + checkedOut.add(null); setParameter(DOCUMENTS, docs); setParameter(RC, checkedOut); - setParameter(SOURCEURL,request); + setParameter(SOURCEURL, request); SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz"); setParameter(DATEFORMAT, format); @@ -128,7 +130,7 @@ } return document; } - + private Publication publication; /** @@ -149,5 +151,5 @@ } return this.publication; } - + } Modified: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Propfind.java URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Propfind.java?rev=219009&r1=219008&r2=219009&view=diff ============================================================================== --- lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Propfind.java (original) +++ lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Propfind.java Thu Jul 14 01:06:45 2005 @@ -45,8 +45,8 @@ */ public class Propfind extends SiteUsecase { - protected static final String DOCUMENT = "document"; - protected static final String DOCUMENTS = "documents"; + protected static final String DOCUMENT = "document"; + protected static final String DOCUMENTS = "documents"; protected static final String SOURCEURL = "sourceURL"; protected static final String DATEFORMAT = "dateFormat"; protected static final String RC = "rc"; @@ -63,7 +63,7 @@ */ protected void initParameters() { super.initParameters(); - + Publication _publication = this.getPublication(); ServiceSelector selector = null; @@ -72,14 +72,14 @@ DocumentBuilder docBuilder = null; Vector docs = new Vector(); Vector checkedOut = new Vector(); - + String request = getSourceURL(); - if(request.endsWith(".html")) - request = request.substring(0,request.indexOf(".html")); - if(!request.endsWith("/")) - request = request+"/"; + if (request.endsWith(".html")) + request = request.substring(0, request.indexOf(".html")); + if (!request.endsWith("/")) + request = request + "/"; try { - //get Parameters for RC + // get Parameters for RC String publicationPath = _publication.getDirectory().getCanonicalPath(); RCEnvironment rcEnvironment = RCEnvironment.getInstance(_publication.getServletContext() .getCanonicalPath()); @@ -89,70 +89,78 @@ backupDirectory = publicationPath + File.separator + backupDirectory; // Initialize Revision Controller - RevisionController rc = new RevisionController(rcmlDirectory, backupDirectory, publicationPath); - - selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector"); + RevisionController rc = new RevisionController(rcmlDirectory, + backupDirectory, + publicationPath); + + selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector"); siteManager = (SiteManager) selector.select(_publication.getSiteManagerHint()); - Document[] documents = siteManager.getDocuments(getDocumentIdentityMap(),_publication,this.getArea()); + Document[] documents = siteManager.getDocuments(getDocumentIdentityMap(), + _publication, + this.getArea()); selector = (ServiceSelector) this.manager.lookup(DocumentBuilder.ROLE + "Selector"); docBuilder = (DocumentBuilder) selector.select(_publication.getDocumentBuilderHint()); - - for(int i=0; i< documents.length; i++) { - String test = documents[i].getCanonicalWebappURL().replaceFirst("/[^/]*.html",""); - if(!test.endsWith("/")) - test = test+"/"; - if(test.equals(request)){ + + for (int i = 0; i < documents.length; i++) { + String test = documents[i].getCanonicalWebappURL().replaceFirst("/[^/]*.html", ""); + if (!test.endsWith("/")) + test = test + "/"; + if (test.equals(request)) { docs.add(documents[i]); - String filename = documents[i].getFile().getCanonicalPath(); - filename = filename.substring(publicationPath.length()); - RCMLEntry entry = rc.getRCML(filename).getLatestEntry(); - if ((entry != null) && (entry.getType() == RCML.co) ) - checkedOut.add(entry); - else - checkedOut.add(null); - //get additional language documents + String filename = documents[i].getFile().getCanonicalPath(); + filename = filename.substring(publicationPath.length()); + RCMLEntry entry = rc.getRCML(filename).getLatestEntry(); + if ((entry != null) && (entry.getType() == RCML.co)) + checkedOut.add(entry); + else + checkedOut.add(null); + // get additional language documents String[] langs = documents[i].getLanguages(); - for(int j=0; j< langs.length; j++) { - if(!(langs[j].equals(documents[i].getLanguage()))) { - String url = documents[i].getCanonicalWebappURL().replaceFirst(".html$","_"+langs[j]+".html"); - Document langDoc = docBuilder.buildDocument(documents[i].getIdentityMap(),_publication,url); - docs.add(langDoc); - - filename = langDoc.getFile().getCanonicalPath(); - filename = filename.substring(publicationPath.length()); - entry = rc.getRCML(filename).getLatestEntry(); - if ((entry != null) && (entry.getType() == RCML.co) ) - checkedOut.add(entry); - else - checkedOut.add(null); - } + for (int j = 0; j < langs.length; j++) { + if (!(langs[j].equals(documents[i].getLanguage()))) { + String url = documents[i].getCanonicalWebappURL() + .replaceFirst(".html$", "_" + langs[j] + ".html"); + Document langDoc = docBuilder.buildDocument(documents[i].getIdentityMap(), + _publication, + url); + docs.add(langDoc); + + filename = langDoc.getFile().getCanonicalPath(); + filename = filename.substring(publicationPath.length()); + entry = rc.getRCML(filename).getLatestEntry(); + if ((entry != null) && (entry.getType() == RCML.co)) + checkedOut.add(entry); + else + checkedOut.add(null); + } } - } + } } - - //get assets if we are currently looking at a document - if (!request.equals("/"+_publication.getId()+"/authoring/")) { - String url = request.substring(0,request.length()-1)+".html"; - Document currentDoc = docBuilder.buildDocument(getDocumentIdentityMap(),_publication,url); + + // get assets if we are currently looking at a document + if (!request.equals("/" + _publication.getId() + "/authoring/")) { + String url = request.substring(0, request.length() - 1) + ".html"; + Document currentDoc = docBuilder.buildDocument(getDocumentIdentityMap(), + _publication, + url); if (currentDoc.exists()) { - resourcesManager = (ResourcesManager) this.manager.lookup(ResourcesManager.ROLE); + resourcesManager = (ResourcesManager) this.manager.lookup(ResourcesManager.ROLE); Resource[] resources = resourcesManager.getResources(currentDoc); - setParameter("assets", Arrays.asList(resources)); + setParameter("assets", Arrays.asList(resources)); } } - + setParameter(DOCUMENTS, docs); setParameter(RC, checkedOut); - setParameter(SOURCEURL,request); + setParameter(SOURCEURL, request); SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz"); setParameter(DATEFORMAT, format); Date rootModDate = new Date(); - setParameter("rootModDate",rootModDate); + setParameter("rootModDate", rootModDate); String defaultLang = _publication.getDefaultLanguage(); - setParameter("defaultLang",defaultLang); - + setParameter("defaultLang", defaultLang); } catch (Exception e) { throw new RuntimeException(e); @@ -195,5 +203,5 @@ } return this.publication; } - + } Modified: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Put.java URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Put.java?rev=219009&r1=219008&r2=219009&view=diff ============================================================================== --- lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Put.java (original) +++ lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav/Put.java Thu Jul 14 01:06:45 2005 @@ -78,10 +78,11 @@ documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE); - DocumentIdentityMap map = (DocumentIdentityMap) getUnitOfWork() - .getIdentityMap(); - Document document = map.get(getPublication(), doc.getArea(), doc.getId(), doc - .getLanguage()); + DocumentIdentityMap map = (DocumentIdentityMap) getUnitOfWork().getIdentityMap(); + Document document = map.get(getPublication(), + doc.getArea(), + doc.getId(), + doc.getLanguage()); resourceType = (ResourceType) selector.select("xhtml"); documentManager.add(document, resourceType, doc.getName(), null); @@ -130,10 +131,8 @@ + "] does not exist."); } - InputSource schemaInputSource = org.apache.cocoon.components.source.SourceUtil - .getInputSource(schemaSource); - InputSource xmlInputSource = org.apache.cocoon.components.source.SourceUtil - .getInputSource(tempSource); + InputSource schemaInputSource = org.apache.cocoon.components.source.SourceUtil.getInputSource(schemaSource); + InputSource xmlInputSource = org.apache.cocoon.components.source.SourceUtil.getInputSource(tempSource); String message = RelaxNG.validate(schemaInputSource, xmlInputSource); if (message != null) { @@ -171,7 +170,7 @@ SiteStructure structure = SiteUtil.getSiteStructure(this.manager, getSourceDocument()); nodes.add(structure.getRepositoryNode()); - + return (Transactionable[]) nodes.toArray(new Transactionable[nodes.size()]); } catch (Exception e) { @@ -182,10 +181,8 @@ /** * Sets the meta data of the created document. * - * @param document - * The document. - * @throws DocumentException - * if an error occurs. + * @param document The document. + * @throws DocumentException if an error occurs. */ protected void setMetaData(Document document) throws DocumentException { @@ -207,10 +204,9 @@ private Publication publication; /** - * Access to the current publication. Use this when the publication is not - * yet known in the usecase: e.g. when creating a global asset. When adding - * a resource or a child to a document, access the publication via that - * document's interface instead. + * Access to the current publication. Use this when the publication is not yet known in the + * usecase: e.g. when creating a global asset. When adding a resource or a child to a document, + * access the publication via that document's interface instead. * * @return the publication in which the use-case is being executed */
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | svn commit: r219008 - /lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/SessionViewer.java, andreas |
|---|---|
| Next by Date: | svn commit: r219019 - /lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateDocument.java, michi |
| Previous by Thread: | svn commit: r219008 - /lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/SessionViewer.java, andreas |
| Next by Thread: | svn commit: r219019 - /lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateDocument.java, michi |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |