juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r821133 - in /webservices/juddi/trunk: docs/ juddi-console/uddi-portlets/ juddi-core/src/main/java/org/apache/juddi/config/ juddi-core/src/test/resources/ juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data...
Date Fri, 02 Oct 2009 19:03:25 GMT
Author: kstam
Date: Fri Oct  2 19:03:24 2009
New Revision: 821133

URL: http://svn.apache.org/viewvc?rev=821133&view=rev
Log:
JUDDI-204, adding capability to install root publisher named something other then "root"

Added:
    webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/PublisherFileFilter.java
Modified:
    webservices/juddi/trunk/docs/jUDDI-UserGuide.odt
    webservices/juddi/trunk/docs/jUDDI-UserGuide.pdf
    webservices/juddi/trunk/juddi-console/uddi-portlets/uddi-portlets.launch
    webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
    webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
    webservices/juddi/trunk/juddi-core/src/test/resources/juddiv3.properties
    webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/affa_Publisher.xml
    webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/root_BusinessEntity.xml
    webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java

Modified: webservices/juddi/trunk/docs/jUDDI-UserGuide.odt
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/jUDDI-UserGuide.odt?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
Binary files - no diff available.

Modified: webservices/juddi/trunk/docs/jUDDI-UserGuide.pdf
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/docs/jUDDI-UserGuide.pdf?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
Binary files - no diff available.

Modified: webservices/juddi/trunk/juddi-console/uddi-portlets/uddi-portlets.launch
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-console/uddi-portlets/uddi-portlets.launch?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-console/uddi-portlets/uddi-portlets.launch (original)
+++ webservices/juddi/trunk/juddi-console/uddi-portlets/uddi-portlets.launch Fri Oct  2 19:03:24
2009
@@ -64,9 +64,11 @@
 <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry
internalArchive=&quot;/jUDDI/juddi-console/uddi-portlets/target/uddi-portlets-3.0.0.SNAPSHOT/WEB-INF/lib/uddi-ws-3.0.0.SNAPSHOT.jar&quot;
path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
 <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry
internalArchive=&quot;/juddi-console/uddi-portlets/src/main/resources&quot; path=&quot;3&quot;
type=&quot;2&quot;/&gt;&#10;"/>
 </listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.classpathProvider"/>
 <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out target/www
org.apache.juddi.portlets.UDDIBrowser/UDDIBrowser.html"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="juddi-console"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.sourcepathProvider"/>
 <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XstartOnFirstThread
-Xmx256M"/>
 </launchConfiguration>

Modified: webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
(original)
+++ webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
Fri Oct  2 19:03:24 2009
@@ -17,14 +17,21 @@
 
 package org.apache.juddi.config;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.Enumeration;
 import java.util.List;
 import java.util.StringTokenizer;
 import java.util.UUID;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -50,6 +57,7 @@
 import org.apache.juddi.validation.ValidatePublish;
 import org.apache.juddi.validation.ValidateUDDIKey;
 import org.apache.log4j.Logger;
+import org.apache.log4j.helpers.Loader;
 import org.uddi.api_v3.SaveTModel;
 import org.uddi.api_v3.TModel;
 import org.uddi.v3_service.DispositionReportFaultMessage;
@@ -69,7 +77,6 @@
 	public static final String JUDDI_CUSTOM_INSTALL_DATA_DIR = "juddi_custom_install_data/";
 	public static Logger log = Logger.getLogger(Install.class);
 
-	@SuppressWarnings("unchecked")
 	protected static void install(Configuration config) throws JAXBException, DispositionReportFaultMessage,
IOException, ConfigurationException {
 				
 		EntityManager em = PersistenceManager.getEntityManager();
@@ -93,6 +100,7 @@
 			String nodeId = getNodeId(rootBusinessEntity.getBusinessKey(), rootPartition);
 			
 			String fileRootPublisher = rootPublisherStr + FILE_PUBLISHER;
+			log.info("Loading the root Publisher from file " + fileRootPublisher);
 			rootPublisher = installPublisher(em, fileRootPublisher, config);
 			
 			installRootPublisherKeyGen(em, rootTModelKeyGen, rootPartition, rootPublisher, nodeId);
@@ -100,7 +108,7 @@
 			rootBusinessEntity.setBusinessKey(nodeId);
 			installBusinessEntity(true, em, rootBusinessEntity, rootPublisher, rootPartition, config);
 			
-			List<String> juddiPublishers = config.getList(Property.JUDDI_PUBLISHERS);
+			List<String> juddiPublishers = getPublishers(config);
 			for (String publisherStr : juddiPublishers) {
 				String filePublisher = publisherStr + FILE_PUBLISHER;
 				String fileTModelKeygen = publisherStr + FILE_TMODELKEYGEN;
@@ -171,7 +179,6 @@
 		}
 	}
 
-	@SuppressWarnings("unchecked")
 	protected static boolean alreadyInstalled(EntityManager em, Configuration config) throws
ConfigurationException {
 		
 		String rootPublisherStr = config.getString(Property.JUDDI_ROOT_PUBLISHER);
@@ -179,7 +186,7 @@
 		if (publisher != null)
 			return true;
 
-		List<String> publishers = config.getList(Property.JUDDI_PUBLISHERS);
+		List<String> publishers = getPublishers(config);
 		for (String publisherStr : publishers) {
 			publisher = em.find(org.apache.juddi.model.Publisher.class, publisherStr);
 			if (publisher != null)
@@ -464,24 +471,75 @@
 		
 	}
 	
-	private static Object buildInstallEntity(String fileName, String packageName, Configuration
config) throws JAXBException, IOException, ConfigurationException {
+	private static List<String> getPublishers(Configuration config) throws ConfigurationException
{
+		List<String> publishers = new ArrayList<String>();
+		String basePath = JUDDI_CUSTOM_INSTALL_DATA_DIR;
+		URL url = Loader.getResource(JUDDI_CUSTOM_INSTALL_DATA_DIR);
+		if (url==null) {
+			url = Loader.getResource(JUDDI_INSTALL_DATA_DIR);
+			basePath = JUDDI_INSTALL_DATA_DIR;
+		}
+		String path=url.getPath();
+		File dir = new File(path);
+		String rootPublisherStr = config.getString(Property.JUDDI_ROOT_PUBLISHER);
+		if (dir.exists()) {
+			log.debug("Discovering the Publisher XML data files in directory: " + path);
+			File[] files = dir.listFiles(new PublisherFileFilter());
+		    for (File f : files)
+		    {	
+		        String publisher = f.getName().substring(0,f.getName().indexOf(FILE_PUBLISHER));
+		        if (! rootPublisherStr.equalsIgnoreCase(publisher)) {
+		        	publishers.add(publisher);
+		        } 
+		    }
+		} else {
+			String[] paths = path.split("!");
+			try {
+				log.debug("Discovering the Publisher XML data files in jar: " + paths[0]);
+				Enumeration<JarEntry> en = new JarFile(new File(new URI(paths[0]))).entries();
+				while (en.hasMoreElements()) {
+					String name = en.nextElement().getName();
+					if (name.endsWith(FILE_PUBLISHER)) {
+						log.debug("Found publisher file=" + name);
+						String publisher = name.substring(basePath.length(),name.indexOf(FILE_PUBLISHER));
+				        if (! rootPublisherStr.equalsIgnoreCase(publisher)) {
+				        	publishers.add(publisher);
+				        } 
+					}
+				}
+			} catch (IOException e) {
+				throw new ConfigurationException(e);
+			} catch (URISyntaxException e) {
+				throw new ConfigurationException(e);
+			}
+		}
+		return publishers;
+	}
+	
+	private static Object buildInstallEntity(final String fileName, String packageName, Configuration
config) throws JAXBException, IOException, ConfigurationException {
 		InputStream resourceStream = null;
 		
 		// First try the custom install directory
-		URL url = Thread.currentThread().getContextClassLoader().getResource(JUDDI_CUSTOM_INSTALL_DATA_DIR
+ fileName);
+		URL url = Loader.getResource(JUDDI_CUSTOM_INSTALL_DATA_DIR + fileName);
 		if (url != null) resourceStream = url.openStream();
 		
 		// If the custom install directory doesn't exist, then use the standard install directory
where the resource is guaranteed to exist.
 		if (resourceStream == null) {
-			url = Thread.currentThread().getContextClassLoader().getResource(JUDDI_INSTALL_DATA_DIR
+ fileName);
-			if (url != null) resourceStream = url.openStream();
-		}
-		
-		// If file still does not exist then return null;
-		if (resourceStream == null) {
-			return null;
+			url = Loader.getResource(JUDDI_INSTALL_DATA_DIR + fileName);
+			if (url != null) { 
+				resourceStream = url.openStream();
+			}
+			// If file still does not exist then return null;
+			if (url ==null || resourceStream == null) {
+				if (fileName.endsWith(FILE_PUBLISHER)) {
+					throw new ConfigurationException("Could not locate " + JUDDI_INSTALL_DATA_DIR + fileName);
+				} else {
+					log.debug("Could not locate: " + url);
+				}
+				return null;
+			}
 		}
-		
+		log.info("Loading the content of file: " + url);
 		StringBuilder xml = new StringBuilder();
 	    byte[] b = new byte[4096];
 	    for (int n; (n = resourceStream.read(b)) != -1;) {

Modified: webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
(original)
+++ webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
Fri Oct  2 19:03:24 2009
@@ -3,7 +3,6 @@
 public interface Property 
 {
     public final static String JUDDI_ROOT_PUBLISHER              ="juddi.root.publisher";
-    public final static String JUDDI_PUBLISHERS                  ="juddi.publishers";
 	public final static String JUDDI_PERSISTENCEUNIT_NAME        ="juddi.persistenceunit.name";
 	public final static String JUDDI_AUTHENTICATOR               ="juddi.authenticator";
 	public final static String JUDDI_CONFIGURATION_RELOAD_DELAY  ="juddi.configuration.reload.delay";

Added: webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/PublisherFileFilter.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/PublisherFileFilter.java?rev=821133&view=auto
==============================================================================
--- webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/PublisherFileFilter.java
(added)
+++ webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/PublisherFileFilter.java
Fri Oct  2 19:03:24 2009
@@ -0,0 +1,25 @@
+package org.apache.juddi.config;
+
+import java.io.File;
+import java.io.FileFilter;
+
+import org.apache.log4j.Logger;
+/**
+ * From the 
+ * 
+ * @author kstam
+ *
+ */
+public class PublisherFileFilter implements FileFilter {
+
+	private Logger log = Logger.getLogger(this.getClass());
+	
+	public boolean accept(File file) {
+		log.info("file=" + file);
+		if (file.getName().endsWith(Install.FILE_PUBLISHER)) {
+			return true;
+		}
+		return false;
+	}
+
+}

Modified: webservices/juddi/trunk/juddi-core/src/test/resources/juddiv3.properties
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core/src/test/resources/juddiv3.properties?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-core/src/test/resources/juddiv3.properties (original)
+++ webservices/juddi/trunk/juddi-core/src/test/resources/juddiv3.properties Fri Oct  2 19:03:24
2009
@@ -12,7 +12,6 @@
 juddi.server.port=8080
 
 juddi.root.publisher=root
-juddi.publishers=UDDI
 #
 # Name of the persistence unit to use (the default, "juddiDatabase" refers to the unit compiled
into the juddi library)
 juddi.persistenceunit.name=juddiDatabase

Modified: webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/affa_Publisher.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/affa_Publisher.xml?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
--- webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/affa_Publisher.xml
(original)
+++ webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/affa_Publisher.xml
Fri Oct  2 19:03:24 2009
@@ -15,7 +15,7 @@
  * limitations under the License.
  *
  */ -->
-<publisher xmlns="urn:juddi-apache-org:api_v3" authorizedName="affa">
+<publisher xmlns="urn:juddi-affiliatea-org:api_v3" authorizedName="affa">
   <publisherName>root of affiliate A publisher</publisherName>
   <isAdmin>true</isAdmin>
 </publisher>

Modified: webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/root_BusinessEntity.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/root_BusinessEntity.xml?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
--- webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/root_BusinessEntity.xml
(original)
+++ webservices/juddi/trunk/juddiv3-war/src/main/webapp/WEB-INF/classes/RENAME2ACTIVATE_juddi_custom_install_data/root_BusinessEntity.xml
Fri Oct  2 19:03:24 2009
@@ -47,9 +47,6 @@
     <!-- This discovery URL should point to the home installation URL of jUDDI -->
     <discoveryURL useType="home">http://${juddi.server.name}:${juddi.server.port}/juddiv3</discoveryURL>
   </discoveryURLs>
-  <categoryBag>
-    <keyedReference tModelKey="uddi:uddi.org:categorization:nodes" keyValue="node" />
-  </categoryBag>
   <businessServices>
     <businessService serviceKey="uddi:juddi.apache.org:services-subscriptionlistener"
businessKey="uddi:juddi.apache.org:businesses-asf">
       <name xml:lang="en">UDDI Subscription Listener Service</name>

Modified: webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java?rev=821133&r1=821132&r2=821133&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java
(original)
+++ webservices/juddi/trunk/uddi-client/src/main/java/org/apache/juddi/v3/client/config/XRegistration.java
Fri Oct  2 19:03:24 2009
@@ -38,7 +38,6 @@
 			BusinessService businessService = fromClerk.findService(bindingTemplate.getServiceKey());
 			businessService.getBindingTemplates().getBindingTemplate().clear();
 			businessService.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
-			//TODO Check the keyGenTModel
 			toClerk.register(businessService);
 		} catch (Exception e) {
 			log.error("Could not cross-register. " + e.getMessage() + " " + e.getCause(),e);



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org


Mime
View raw message