Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://svn.apache.org/repos/asf/cocoon/tags/cocoon-22@505978 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Showing
139 changed files
with
9,481 additions
and
0 deletions.
There are no files selected for viewing
296 changes: 296 additions & 0 deletions
296
...dules/cocoon-deployer-modules-1/cocoon-deployer-core/.settings/org.eclipse.jdt.core.prefs
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...modules/cocoon-deployer-modules-1/cocoon-deployer-core/.settings/org.eclipse.jdt.ui.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#Mon Jan 02 22:38:07 GMT+01:00 2006 | ||
eclipse.preferences.version=1 | ||
formatter_settings_version=8 | ||
org.eclipse.jdt.ui.exception.name=e | ||
org.eclipse.jdt.ui.gettersetter.use.is=true | ||
org.eclipse.jdt.ui.ignorelowercasenames=true | ||
org.eclipse.jdt.ui.importorder=java;javax;org;com; | ||
org.eclipse.jdt.ui.javadoc=false | ||
org.eclipse.jdt.ui.keywordthis=false | ||
org.eclipse.jdt.ui.ondemandthreshold=99 | ||
org.eclipse.jdt.ui.overrideannotation=true | ||
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<templates><template id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment" description\="Comment for getter method" context\="gettercomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment" description\="Comment for setter method" context\="settercomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment" description\="Comment for created constructors" context\="constructorcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\r\n * ${tags}\r\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment" description\="Comment for created Java files" context\="filecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\r\n * \r\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment" description\="Comment for created types" context\="typecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment" description\="Comment for fields" context\="fieldcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\r\n * \r\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment" description\="Comment for non-overriding methods" context\="methodcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\r\n * ${tags}\r\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment" description\="Comment for overriding methods" context\="overridecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype" description\="Newly created files" context\="newtype_context" enabled\="true" deleted\="false" autoinsert\="false">/*\r\n * Copyright 2006 The Apache Software Foundation.\r\n * \r\n * Licensed under the Apache License, Version 2.0 (the "License");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock" description\="Code in new catch blocks" context\="catchblock_context" enabled\="true" deleted\="false" autoinsert\="true">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody" description\="Code in created method stubs" context\="methodbody_context" enabled\="true" deleted\="false" autoinsert\="true">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody" description\="Code in created constructor stubs" context\="constructorbody_context" enabled\="true" deleted\="false" autoinsert\="true">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody" description\="Code in created getters" context\="getterbody_context" enabled\="true" deleted\="false" autoinsert\="true">return ${field};</template><template id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody" description\="Code in created setters" context\="setterbody_context" enabled\="true" deleted\="false" autoinsert\="true">${field} \= ${param};</template></templates> |
107 changes: 107 additions & 0 deletions
107
cocoon-deployer-modules/cocoon-deployer-modules-1/cocoon-deployer-core/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2006 The Apache Software Foundation | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<groupId>org.apache.cocoon</groupId> | ||
<artifactId>cocoon-deployer-modules</artifactId> | ||
<version>1</version> | ||
</parent> | ||
|
||
<artifactId>cocoon-deployer-core</artifactId> | ||
<version>1.0.0-M1-SNAPSHOT</version> | ||
|
||
<name>Cocoon Deployer - Core</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>3.8.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>castor</groupId> | ||
<artifactId>castor</artifactId> | ||
<version>1.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>xerces</groupId> | ||
<artifactId>xercesImpl</artifactId> | ||
<version>2.8.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-logging</groupId> | ||
<artifactId>commons-logging</artifactId> | ||
<version>1.0.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-lang</groupId> | ||
<artifactId>commons-lang</artifactId> | ||
<version>2.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>xml-apis</groupId> | ||
<artifactId>xml-apis</artifactId> | ||
<version>1.3.02</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>oro</groupId> | ||
<artifactId>oro</artifactId> | ||
<version>2.0.8</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-transaction</groupId> | ||
<artifactId>commons-transaction</artifactId> | ||
<version>1.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>geronimo-spec</groupId> | ||
<artifactId>geronimo-spec-j2ee</artifactId> | ||
<version>1.0-M1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>easymock</groupId> | ||
<artifactId>easymock</artifactId> | ||
<version>1.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>castor-maven-plugin</artifactId> | ||
<version>1.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
<configuration> | ||
<properties>${basedir}/src/main/castor/castorbuilder.properties</properties> | ||
<schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
5 changes: 5 additions & 0 deletions
5
...s/cocoon-deployer-modules-1/cocoon-deployer-core/src/main/castor/castorbuilder.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
org.exolab.castor.builder.nspackages=\ | ||
http://apache.org/cocoon/blocks/cob/1.0=org.apache.cocoon.deployer.generated.block.x10,\ | ||
http://apache.org/cocoon/blocks/deploy/1.0=org.apache.cocoon.deployer.generated.deploy.x10,\ | ||
http://apache.org/cocoon/blocks/wiring/1.0=org.apache.cocoon.deployer.generated.wiring.x10 | ||
|
34 changes: 34 additions & 0 deletions
34
...les-1/cocoon-deployer-core/src/main/java/org/apache/cocoon/deployer/ArtifactProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2005 The Apache Software Foundation. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.cocoon.deployer; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* The ArtifactProvider is an abstraction of getting access to the actual block. A client using | ||
* this library can make use of it to plugin its own library mechanism. | ||
*/ | ||
public interface ArtifactProvider { | ||
|
||
public File getArtifact(String artifact); | ||
|
||
/** | ||
* This method is used to resolve all dependencies of the passed artifact ids. It supports | ||
* transitive dependencies and makes sure that only one version of an artifact is returned. | ||
*/ | ||
public File[] getArtifact(String[] artifactIds); | ||
|
||
} |
137 changes: 137 additions & 0 deletions
137
...s-1/cocoon-deployer-core/src/main/java/org/apache/cocoon/deployer/AutoWiringResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/* | ||
* Copyright 2006 The Apache Software Foundation. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.cocoon.deployer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.apache.cocoon.deployer.block.Block; | ||
import org.apache.cocoon.deployer.block.BlockFactory; | ||
import org.apache.cocoon.deployer.generated.block.x10.Requires; | ||
import org.apache.cocoon.deployer.generated.deploy.x10.Connection; | ||
import org.apache.cocoon.deployer.logger.Logger; | ||
import org.apache.commons.lang.Validate; | ||
|
||
/** | ||
* The AutoWiringResolver analyzes a block and resolves all connections that are | ||
* not explizitly declared in the deploy script. | ||
*/ | ||
public class AutoWiringResolver { | ||
|
||
public static final String DEPLOY_BLOCK_ID_PREFIX = "auto_wired_"; | ||
|
||
private ArtifactProvider artifactProvider; | ||
private Logger log; | ||
private int autoCreatedBlockCounter = 0; | ||
List autowiredBlockList = new ArrayList(); | ||
|
||
public AutoWiringResolver(final ArtifactProvider artifactProvider, final Logger log) { | ||
Validate.notNull(artifactProvider, "artifactProvider mustn't be null."); | ||
Validate.notNull(log, "log mustn't be null "); | ||
this.artifactProvider = artifactProvider; | ||
this.log = log; | ||
} | ||
|
||
public void resolve(final List blockList) { | ||
Validate.notNull(blockList, "The list of blocks mustn't be null."); | ||
Validate.allElementsOfType(blockList, Block.class); | ||
|
||
// iterator over all blocks | ||
for(Iterator it = blockList.iterator(); it.hasNext();) { | ||
Block block = (Block) it.next(); | ||
analyzeBlock(block); | ||
} | ||
|
||
blockList.addAll(this.autowiredBlockList); | ||
|
||
} | ||
|
||
/** | ||
* Analyze a block and find all unset connections. If an unset connection is found, the default | ||
* connection is read out and autowired by creating a new block. | ||
* | ||
* @param block to be analyzed | ||
* @return a list of all blocks that have to be installed | ||
*/ | ||
protected void analyzeBlock(Block block) { | ||
Validate.notNull(block, "Null value is not allowed for block."); | ||
|
||
Set allExplicitConnections = getAllExplicitConnections(block); | ||
|
||
// if the block has no requirements, the block is an endpoint | ||
if(block.getBlockDescriptor().getRequirements() == null) { | ||
return; | ||
} | ||
|
||
// iterate over all requirements and find out if connections are set in the deployment script | ||
Requires[] requires = block.getBlockDescriptor().getRequirements().getRequires(); | ||
for(int i = 0; i < requires.length; i++) { | ||
|
||
// if no explicit connection is set in the deployment script --> autowire | ||
if(!allExplicitConnections.contains(requires[i].getName())){ | ||
|
||
// create a new block | ||
String newBlockDeployId = getNextDeployBlockId(); | ||
Block autoWiredBlock = BlockFactory.createAutowiredBlock( | ||
artifactProvider.getArtifact(requires[i].getDefault()), newBlockDeployId); | ||
this.log.info("auto-wiring: create new block [" + newBlockDeployId + "]."); | ||
|
||
// add the connection to the deployer | ||
Connection newConnection = new Connection(); | ||
newConnection.setBlock(newBlockDeployId); | ||
newConnection.setName(requires[i].getName()); | ||
if(block.getDeployDescriptor().getConnections() == null) { | ||
block.getDeployDescriptor().setConnections(new org.apache.cocoon.deployer.generated.deploy.x10.Connections()); | ||
} | ||
block.getDeployDescriptor().getConnections().addConnection(newConnection); | ||
|
||
// analyze the new block too | ||
analyzeBlock(autoWiredBlock); | ||
|
||
// add block to the list | ||
this.autowiredBlockList.add(autoWiredBlock); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Get a set of names of all connections of the block. | ||
* | ||
* @param the block to be analyzed | ||
* @return a set of names | ||
*/ | ||
protected Set getAllExplicitConnections(Block block) { | ||
Set allExplicitConnections = new HashSet(); | ||
if(block.getDeployDescriptor().getConnections() != null) { | ||
Connection[] connections = block.getDeployDescriptor().getConnections().getConnection(); | ||
for(int i = 0; i < connections.length; i++) { | ||
allExplicitConnections.add(connections[i].getName()); | ||
} | ||
} | ||
return allExplicitConnections; | ||
} | ||
|
||
/** | ||
* @return the next available name | ||
*/ | ||
protected String getNextDeployBlockId() { | ||
return DEPLOY_BLOCK_ID_PREFIX + this.autoCreatedBlockCounter++; | ||
} | ||
|
||
} |
Oops, something went wrong.