git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@47 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a176507fff
commit
c1a1ec40a2
|
@ -5,5 +5,8 @@
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/CONTAINERLIB"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/CONTAINERLIB"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/GCUBE_CORE"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/GCUBE_CORE"/>
|
||||||
<classpathentry kind="lib" path="SERVICELIBS/GCUBE_ISREGISTRY/org.gcube.informationsystem.registry.stubs.jar"/>
|
<classpathentry kind="lib" path="SERVICELIBS/GCUBE_ISREGISTRY/org.gcube.informationsystem.registry.stubs.jar"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/IS_PUBLISHER"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/ISCLIENT"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/Notifier"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
32
build.xml
32
build.xml
|
@ -15,23 +15,19 @@ flag, or placing them in a separate "build.properties" file). Note that some of
|
||||||
properties make sense _relative_ to other properties for which this buildfile
|
properties make sense _relative_ to other properties for which this buildfile
|
||||||
provides sensible default values (see below)
|
provides sensible default values (see below)
|
||||||
|
|
||||||
|
wsdl.<n>: Filename of the <n>-th wsdl file associated with the service. The script assumes up to 6 wsdls (wsdl.1, wsdl.2, wsdl.3,...).
|
||||||
name: Unique name of the service.
|
|
||||||
wsdl.<n>: Filename of the <n>-th wsdl file associated with the service. The script assumes up to 3 wsdls (wsdl.1, wsdl.2, wsdl.3).
|
|
||||||
Further wsdls require a simple script extension (see guidelines at end of script).
|
Further wsdls require a simple script extension (see guidelines at end of script).
|
||||||
package: Root package of the service implementation: includes code and configuration.
|
package: Root package of the service implementation: includes code and configuration.
|
||||||
package.dir: Directory corresponding to $package, relative to $base.dir (same as $package
|
package.dir: Directory corresponding to $package, relative to ${base.dir} (same as ${package} but with directory separators instead of dots).
|
||||||
but with directory separators instead of dots). It must contain WSDD and JNDI files.
|
lib.dir: Root directory where auxiliary jar files are located. Ideally outside ${base.dir} as not needed for remote build and dynamic deployment.
|
||||||
lib.dir: Root directory where auxiliary jar files are located. Ideally outside $base.dir as not needed for remote build and dynamic deployment.
|
|
||||||
|
|
||||||
OPTIONAL INPUT PROPERTIES (DEFAULT AVAILABLE)
|
OPTIONAL INPUT PROPERTIES (DEFAULT AVAILABLE)
|
||||||
|
|
||||||
base.dir: Root directory of the service. Defaults to ".").
|
base.dir: Root directory of the service. Defaults to ".").
|
||||||
schema.dir.name: Name of the $base.dir subdirectory which contains the wsdl/s. Defaults to "schema".
|
schema.dir.name: Name of the ${base.dir }subdirectory which contains the wsdl(s). Defaults to "schema".
|
||||||
Defaults to $name.
|
etc.dir.name: Name of the directory which contains the configuration (other than WSSD and JNDI). Defaults to "etc".
|
||||||
etc.dir.name: Name of the $package.dir subdirectory which contains the configuration (other than WSSD and JNDI). Defaults to "etc".
|
stubs.dir.name: Name of the ${package.dir} subdirectory which contains auxiliary files and resources for stubs. Defaults to "stubs".
|
||||||
stubs.dir.name: Name of the $package.dir subdirectory which contains auxiliary files and resources for stubs. Defaults to "stubs".
|
garname: Unique name of the GAR file to be generated. Defaults to ${package}.
|
||||||
garname: Unique name of the GAR file to be generated. Defaults to $name.
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<project default="service" name="GCUBE Service Buildfile">
|
<project default="service" name="GCUBE Service Buildfile">
|
||||||
|
@ -77,7 +73,6 @@ garname: Unique name of the GAR file to be generated. Defaults to $name.
|
||||||
|
|
||||||
<!-- input summary -->
|
<!-- input summary -->
|
||||||
<echo message="INPUTS:" level="info"/>
|
<echo message="INPUTS:" level="info"/>
|
||||||
<echo message="Name = ${name}" level="info"/>
|
|
||||||
<echo message="Service Package = ${package}" level="info"/>
|
<echo message="Service Package = ${package}" level="info"/>
|
||||||
<echo message="Service Directory = ${service.dir}/${package.dir}" level="info"/>
|
<echo message="Service Directory = ${service.dir}/${package.dir}" level="info"/>
|
||||||
<echo message="Schema Directory = ${schema.dir}" level="info"/>
|
<echo message="Schema Directory = ${schema.dir}" level="info"/>
|
||||||
|
@ -87,8 +82,8 @@ garname: Unique name of the GAR file to be generated. Defaults to $name.
|
||||||
|
|
||||||
|
|
||||||
<!-- file defaults -->
|
<!-- file defaults -->
|
||||||
<property name="garname" value="${name}"/>
|
<property name="garname" value="${package}"/>
|
||||||
<property name="garfile" value="${package}.gar"/>
|
<property name="garfile" value="${garname}.gar"/>
|
||||||
<property name="jarfile" value="${package}.jar" />
|
<property name="jarfile" value="${package}.jar" />
|
||||||
<property name="jarfile.stubs" value="${package}.stubs.jar" />
|
<property name="jarfile.stubs" value="${package}.stubs.jar" />
|
||||||
|
|
||||||
|
@ -104,9 +99,9 @@ garname: Unique name of the GAR file to be generated. Defaults to $name.
|
||||||
<property name="build.class.dir" location="${build.dir}/classes" />
|
<property name="build.class.dir" location="${build.dir}/classes" />
|
||||||
<property name="build.lib.dir" location="${build.dir}/lib" />
|
<property name="build.lib.dir" location="${build.dir}/lib" />
|
||||||
<property name="build.schema.dir" location="${build.dir}/schema" />
|
<property name="build.schema.dir" location="${build.dir}/schema" />
|
||||||
<property name="build.schema.service.dir" location="${build.schema.dir}/${name}" />
|
<property name="build.schema.service.dir" location="${build.schema.dir}/${package}" />
|
||||||
|
|
||||||
<property name="build.stubs.dir" location="${build.dir}/stubs-${name}" />
|
<property name="build.stubs.dir" location="${build.dir}/stubs-${package}" />
|
||||||
<property name="build.stubs.src.dir" location="${build.stubs.dir}/src" />
|
<property name="build.stubs.src.dir" location="${build.stubs.dir}/src" />
|
||||||
<property name="build.stubs.class.dir" location="${build.stubs.dir}/classes" />
|
<property name="build.stubs.class.dir" location="${build.stubs.dir}/classes" />
|
||||||
|
|
||||||
|
@ -128,7 +123,7 @@ garname: Unique name of the GAR file to be generated. Defaults to $name.
|
||||||
<fileset dir="${build.lib.dir}" id="garjars" />
|
<fileset dir="${build.lib.dir}" id="garjars" />
|
||||||
<property name="garjars.id" value="garjars" />
|
<property name="garjars.id" value="garjars" />
|
||||||
<fileset dir="${build.schema.dir}" id="garschema">
|
<fileset dir="${build.schema.dir}" id="garschema">
|
||||||
<include name="${name}/**" />
|
<include name="${package}/**" />
|
||||||
</fileset>
|
</fileset>
|
||||||
<property name="garschema.id" value="garschema" />
|
<property name="garschema.id" value="garschema" />
|
||||||
<fileset dir="${etc.dir}" id="garetc" />
|
<fileset dir="${etc.dir}" id="garetc" />
|
||||||
|
@ -420,6 +415,9 @@ garname: Unique name of the GAR file to be generated. Defaults to $name.
|
||||||
<exclude name="**/*.class" />
|
<exclude name="**/*.class" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
<copy toDir="${build.stubs.class.dir}/${package.dir}/${stubs.dir.name}/bindings" overwrite="false">
|
||||||
|
<fileset dir="${etc.dir}" casesensitive="yes" />
|
||||||
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="jarStubs" depends="buildStubs" description="jar stub classes">
|
<target name="jarStubs" depends="buildStubs" description="jar stub classes">
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<service name="gcube/informationsystem/registry">
|
<service name="gcube/informationsystem/registry">
|
||||||
|
|
||||||
<environment
|
<environment
|
||||||
name="profile"
|
name="configDir"
|
||||||
value="@config.dir@/profile.xml"
|
value="@config.dir@"
|
||||||
type="java.lang.String"
|
type="java.lang.String"
|
||||||
override="false" />
|
override="false" />
|
||||||
|
|
||||||
|
|
|
@ -6,27 +6,27 @@
|
||||||
|
|
||||||
<service name="gcube/informationsystem/registry/Registry" provider="Handler" use="literal" style="document">
|
<service name="gcube/informationsystem/registry/Registry" provider="Handler" use="literal" style="document">
|
||||||
<parameter name="className" value="org.gcube.informationsystem.registry.impl.core.Registry"/>
|
<parameter name="className" value="org.gcube.informationsystem.registry.impl.core.Registry"/>
|
||||||
<wsdlFile>share/schema/Registry/Registry_service.wsdl</wsdlFile>
|
<wsdlFile>share/schema/org.gcube.informationsystem.registry/Registry_service.wsdl</wsdlFile>
|
||||||
<parameter name="allowedMethods" value="*"/>
|
<parameter name="allowedMethods" value="*"/>
|
||||||
<parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/>
|
<parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/>
|
||||||
<parameter name="scope" value="Application"/>
|
<parameter name="scope" value="Application"/>
|
||||||
<parameter name="providers" value="GCUBEProvider SubscribeProvider GetCurrentMessageProvider "/>
|
<parameter name="providers" value="GCUBEProvider SubscribeProvider GetCurrentMessageProvider "/>
|
||||||
<parameter name="loadOnStartup" value="false"/>
|
<parameter name="loadOnStartup" value="false"/>
|
||||||
<!--parameter name="securityDescriptor" value="@config.dir@/security-descriptor-Service.xml"/-->
|
<parameter name="securityDescriptor" value="@config.dir@/security-descriptor-Service.xml"/>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
|
||||||
<!-- Factory service -->
|
<!-- Factory service -->
|
||||||
<service name="gcube/informationsystem/registry/RegistryFactory" provider="Handler" use="literal" style="document">
|
<service name="gcube/informationsystem/registry/RegistryFactory" provider="Handler" use="literal" style="document">
|
||||||
<parameter name="className" value="org.gcube.informationsystem.registry.impl.core.RegistryFactory"/>
|
<parameter name="className" value="org.gcube.informationsystem.registry.impl.core.RegistryFactory"/>
|
||||||
<wsdlFile>share/schema/Registry/RegistryFactory_service.wsdl</wsdlFile>
|
<wsdlFile>share/schema/org.gcube.informationsystem.registry/RegistryFactory_service.wsdl</wsdlFile>
|
||||||
<parameter name="allowedMethods" value="*"/>
|
<parameter name="allowedMethods" value="*"/>
|
||||||
<parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/>
|
<parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/>
|
||||||
<parameter name="scope" value="Application"/>
|
<parameter name="scope" value="Application"/>
|
||||||
<parameter name="instance" value="gcube/informationsystem/registry/Registry"/>
|
<parameter name="instance" value="gcube/informationsystem/registry/Registry"/>
|
||||||
<parameter name="providers" value="GCUBEProvider SubscribeProvider GetCurrentMessageProvider"/>
|
<parameter name="providers" value="GCUBEProvider SubscribeProvider GetCurrentMessageProvider"/>
|
||||||
<parameter name="loadOnStartup" value="true"/>
|
<parameter name="loadOnStartup" value="true"/>
|
||||||
<!--parameter name="securityDescriptor" value="@config.dir@/security-descriptor-Factory.xml"/-->
|
<parameter name="securityDescriptor" value="@config.dir@/security-descriptor-Factory.xml"/>
|
||||||
|
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<service name="gcube/informationsystem/registry/Registry" provider="Handler" use="literal" style="document">
|
<service name="gcube/informationsystem/registry/Registry" provider="Handler" use="literal" style="document">
|
||||||
<parameter name="className" value="org.gcube.informationservice.registry.impl.core.Registry"/>
|
<parameter name="className" value="org.gcube.informationservice.registry.impl.core.Registry"/>
|
||||||
<wsdlFile>share/schema/Registry/Registry_service.wsdl</wsdlFile>
|
<wsdlFile>share/schema/org.gcube.informationsystem.registry/Registry_service.wsdl</wsdlFile>
|
||||||
<parameter name="allowedMethods" value="*"/>
|
<parameter name="allowedMethods" value="*"/>
|
||||||
<parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/>
|
<parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/>
|
||||||
<parameter name="scope" value="Application"/>
|
<parameter name="scope" value="Application"/>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<!-- Factory service -->
|
<!-- Factory service -->
|
||||||
<service name="gcube/informationsystem/registry/RegistryFactory" provider="Handler" use="literal" style="document">
|
<service name="gcube/informationsystem/registry/RegistryFactory" provider="Handler" use="literal" style="document">
|
||||||
<parameter name="className" value="org.gcube.informationsystem.registry.impl.core.RegistryFactory"/>
|
<parameter name="className" value="org.gcube.informationsystem.registry.impl.core.RegistryFactory"/>
|
||||||
<wsdlFile>share/schema/Registry/RegistryFactory_service.wsdl</wsdlFile>
|
<wsdlFile>share/schema/org.gcube.informationsystem.registry/RegistryFactory_service.wsdl</wsdlFile>
|
||||||
<parameter name="allowedMethods" value="*"/>
|
<parameter name="allowedMethods" value="*"/>
|
||||||
<parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/>
|
<parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/>
|
||||||
<parameter name="scope" value="Application"/>
|
<parameter name="scope" value="Application"/>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<agg:TopicExpression wsnt:Dialect="http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple"
|
<agg:TopicExpression wsnt:Dialect="http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple"
|
||||||
xmlns:wsnt="http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd"
|
xmlns:wsnt="http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd"
|
||||||
xmlns:wssgtopic="http://diligentproject.org/namespaces/informationservice/disregistry/DISRegistryFactoryService">
|
xmlns:wssgtopic="http://diligentproject.org/namespaces/informationservice/disregistry/DISRegistryFactoryService">
|
||||||
wssgtopic:ExternalRunningInstanceCounter
|
wssgtopic:ExternalRunningInstance
|
||||||
</agg:TopicExpression>
|
</agg:TopicExpression>
|
||||||
</agg:AggregatorSubscriptionType>
|
</agg:AggregatorSubscriptionType>
|
||||||
</agg:AggregatorConfig>
|
</agg:AggregatorConfig>
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package org.gcube.informationsystem.registry.impl.core;
|
package org.gcube.informationsystem.registry.impl.core;
|
||||||
|
|
||||||
|
import java.io.StringReader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.common.core.is.publisher.ISPublisher;
|
import org.gcube.common.core.is.publisher.ISPublisher;
|
||||||
|
@ -16,6 +19,8 @@ import org.gcube.common.core.resources.GCUBEService;
|
||||||
import org.gcube.common.core.state.GCUBEWSResource;
|
import org.gcube.common.core.state.GCUBEWSResource;
|
||||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||||
import org.globus.wsrf.ResourceException;
|
import org.globus.wsrf.ResourceException;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,15 +60,24 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
@Override
|
@Override
|
||||||
public void initialise(Object... params) throws ResourceException {
|
public void initialise(Object... params) throws ResourceException {
|
||||||
GCUBEResource resource = (GCUBEResource) params[0];
|
GCUBEResource resource = (GCUBEResource) params[0];
|
||||||
|
Document dom = null;
|
||||||
StringWriter writer =new StringWriter();
|
StringWriter writer =new StringWriter();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resource.store(writer);
|
resource.store(writer);
|
||||||
|
|
||||||
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
|
|
||||||
|
StringReader reader = new StringReader(writer.toString().substring(writer.toString().indexOf("?>")+2, writer.toString().length()));
|
||||||
|
InputSource source = new InputSource(reader);
|
||||||
|
dom =builder.parse(source);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
throw new ResourceException();
|
throw new ResourceException(e1);
|
||||||
}
|
}
|
||||||
this.setProfile(writer.toString());
|
|
||||||
this.setNotificationProfile(writer.toString());
|
this.setProfile(dom);
|
||||||
|
this.setNotificationProfile(dom);
|
||||||
this.setGCubeResource(resource);
|
this.setGCubeResource(resource);
|
||||||
|
|
||||||
if (hasToLive(resource)) this.setTerminationTime(null);
|
if (hasToLive(resource)) this.setTerminationTime(null);
|
||||||
|
@ -89,26 +103,26 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotificationProfile(String profile) {
|
public void setNotificationProfile(Document profile) {
|
||||||
this.getResourcePropertySet().get(NotificationProfileRP).clear();
|
this.getResourcePropertySet().get(NotificationProfileRP).clear();
|
||||||
this.getResourcePropertySet().get(NotificationProfileRP).add(profile);
|
this.getResourcePropertySet().get(NotificationProfileRP).add(profile);
|
||||||
this.getPersistenceDelegate().store(this);
|
this.getPersistenceDelegate().store(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNotificationProfile() {
|
public Document getNotificationProfile() {
|
||||||
return (String)this.getResourcePropertySet().get(NotificationProfileRP).get(0);
|
return (Document)this.getResourcePropertySet().get(NotificationProfileRP).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setProfile(String profile) {
|
public void setProfile(Document profile) {
|
||||||
this.getResourcePropertySet().get(ProfileRP).clear();
|
this.getResourcePropertySet().get(ProfileRP).clear();
|
||||||
this.getResourcePropertySet().get(ProfileRP).add(profile);
|
this.getResourcePropertySet().get(ProfileRP).add(profile);
|
||||||
this.getPersistenceDelegate().store(this);
|
this.getPersistenceDelegate().store(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProfile() {
|
public Document getProfile() {
|
||||||
return (String)this.getResourcePropertySet().get(ProfileRP).get(0);
|
return (Document)this.getResourcePropertySet().get(ProfileRP).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,13 +197,21 @@ public class ProfileResource extends GCUBEWSResource {
|
||||||
|
|
||||||
|
|
||||||
public void updateResource(GCUBEResource resource) throws Exception{
|
public void updateResource(GCUBEResource resource) throws Exception{
|
||||||
|
|
||||||
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
resource.store(writer);
|
resource.store(writer);
|
||||||
this.setProfile(writer.toString());
|
StringReader reader = new StringReader(writer.toString());
|
||||||
|
InputSource source = new InputSource(reader);
|
||||||
|
Document dom = builder.parse(source);
|
||||||
|
|
||||||
|
|
||||||
|
this.setProfile(dom);
|
||||||
this.setGCubeResource(resource);
|
this.setGCubeResource(resource);
|
||||||
|
|
||||||
if (this.hasToLive(resource))
|
if (this.hasToLive(resource))
|
||||||
this.setNotificationProfile(writer.toString());
|
this.setNotificationProfile(dom);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.informationsystem.registry.impl.core;
|
package org.gcube.informationsystem.registry.impl.core;
|
||||||
|
|
||||||
|
import org.apache.axis.utils.XMLUtils;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
import org.gcube.common.core.faults.GCUBEFault;
|
||||||
import org.gcube.informationsystem.registry.stubs.GetProfileString;
|
import org.gcube.informationsystem.registry.stubs.GetProfileString;
|
||||||
import org.gcube.informationsystem.registry.impl.core.ProfileResource;
|
import org.gcube.informationsystem.registry.impl.core.ProfileResource;
|
||||||
|
@ -9,8 +10,9 @@ import org.globus.wsrf.ResourceException;
|
||||||
public class Registry {
|
public class Registry {
|
||||||
|
|
||||||
public String getProfileString(GetProfileString voidType) throws GCUBEFault{
|
public String getProfileString(GetProfileString voidType) throws GCUBEFault{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return ((ProfileResource)ProfileContext.getContext().getWSHome().find()).getProfile();
|
return XMLUtils.DocumentToString(((ProfileResource)ProfileContext.getContext().getWSHome().find()).getProfile());
|
||||||
} catch (ResourceException e) {
|
} catch (ResourceException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new GCUBEFault();
|
throw new GCUBEFault();
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.rmi.RemoteException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import org.apache.axis.utils.XMLUtils;
|
||||||
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||||
import org.gcube.common.core.contexts.GHNContext;
|
import org.gcube.common.core.contexts.GHNContext;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
import org.gcube.common.core.faults.GCUBEFault;
|
||||||
|
@ -311,7 +312,7 @@ public class RegistryFactory extends GCUBEStartupPortType{
|
||||||
try{
|
try{
|
||||||
|
|
||||||
ProfileResource resource = getProfileResource(ID );
|
ProfileResource resource = getProfileResource(ID );
|
||||||
profile.load(new StringReader(resource.getProfile()));
|
profile.load(new StringReader( XMLUtils.DocumentToString(resource.getProfile())));
|
||||||
//remove profile
|
//remove profile
|
||||||
resource.removeProfile();
|
resource.removeProfile();
|
||||||
RegistryServiceAddressingLocator locator = new RegistryServiceAddressingLocator();
|
RegistryServiceAddressingLocator locator = new RegistryServiceAddressingLocator();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.registry.impl.core;
|
||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import org.gcube.common.core.persistence.GCUBEWSFilePersistenceDelegate;
|
import org.gcube.common.core.persistence.GCUBEWSFilePersistenceDelegate;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
public class RegistryPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<ProfileResource> {
|
public class RegistryPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<ProfileResource> {
|
||||||
|
|
||||||
|
@ -10,14 +11,14 @@ public class RegistryPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<
|
||||||
protected void onLoad(ProfileResource resource, ObjectInputStream ois) throws Exception {
|
protected void onLoad(ProfileResource resource, ObjectInputStream ois) throws Exception {
|
||||||
|
|
||||||
super.onLoad(resource, ois);
|
super.onLoad(resource, ois);
|
||||||
resource.setProfile((String)ois.readUTF());
|
resource.setProfile((Document)ois.readObject());
|
||||||
resource.setNotificationProfile(resource.getProfile());
|
resource.setNotificationProfile(resource.getProfile());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onStore(ProfileResource resource,ObjectOutputStream oos) throws Exception {
|
protected void onStore(ProfileResource resource,ObjectOutputStream oos) throws Exception {
|
||||||
|
|
||||||
super.onStore(resource, oos);
|
super.onStore(resource, oos);
|
||||||
oos.writeUTF(resource.getProfile());
|
oos.writeObject((Document)resource.getProfile());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class RegistrationThread implements Runnable{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static GCUBELog logger = new GCUBELog(RegistrationThread.class.getName());
|
private static GCUBELog logger = new GCUBELog(RegistrationThread.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -55,6 +55,7 @@ public class RegistrationThread implements Runnable{
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ISPublisher publisher = GHNContext.getImplementation(ISPublisher.class);
|
ISPublisher publisher = GHNContext.getImplementation(ISPublisher.class);
|
||||||
|
logger.debug("DefaultScope: "+GHNContext.getContext().getDefaultScope() );
|
||||||
publisher.registerToISNotification(FactoryContext.getContext().getEPR(),topics, GHNContext.getContext().getDefaultScope(), ServiceContext.getContext() );
|
publisher.registerToISNotification(FactoryContext.getContext().getEPR(),topics, GHNContext.getContext().getDefaultScope(), ServiceContext.getContext() );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package org.gcube.informationsystem.registry.test;
|
||||||
|
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
|
import org.apache.axis.message.addressing.Address;
|
||||||
|
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||||
|
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||||
|
import org.gcube.common.core.resources.GCUBEService;
|
||||||
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
|
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
||||||
|
import org.gridforum.jgss.ExtendedGSSCredential;
|
||||||
|
|
||||||
|
public class RegistryRemoveTest {
|
||||||
|
|
||||||
|
public static void main (String[]args ) throws Exception {
|
||||||
|
|
||||||
|
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
||||||
|
|
||||||
|
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
||||||
|
|
||||||
|
ExtendedGSSCredential cred =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]);
|
||||||
|
|
||||||
|
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
||||||
|
|
||||||
|
RegistryFactoryPortType registryFactoryPortType= null;
|
||||||
|
try {
|
||||||
|
factoryEPR.setAddress(new Address(args[0]));
|
||||||
|
registryFactoryPortType = registryLocator.getRegistryFactoryPortTypePort(factoryEPR);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
RemoveResourceMessage message = new RemoveResourceMessage();
|
||||||
|
|
||||||
|
managerSec.useCredentials(cred);
|
||||||
|
registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope("/gcube/devsec"),managerSec);
|
||||||
|
try {
|
||||||
|
StringWriter writer =new StringWriter();
|
||||||
|
message.setType(GCUBEService.TYPE);
|
||||||
|
message.setUniqueID(args[1]);
|
||||||
|
registryFactoryPortType.removeResource(message);
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
System.out.println("Profile with ID "+ args[1]+ "has been succesfully removed");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,8 +5,10 @@ import java.io.StringWriter;
|
||||||
|
|
||||||
import org.apache.axis.message.addressing.Address;
|
import org.apache.axis.message.addressing.Address;
|
||||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||||
|
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||||
import org.gcube.common.core.contexts.GHNContext;
|
import org.gcube.common.core.contexts.GHNContext;
|
||||||
import org.gcube.common.core.resources.GCUBEService;
|
import org.gcube.common.core.resources.GCUBEService;
|
||||||
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||||
import org.gcube.informationsystem.registry.stubs.CreateResourceMessage;
|
import org.gcube.informationsystem.registry.stubs.CreateResourceMessage;
|
||||||
|
@ -43,7 +45,7 @@ public class RegistryTest {
|
||||||
CreateResourceMessage message = new CreateResourceMessage();
|
CreateResourceMessage message = new CreateResourceMessage();
|
||||||
String profile ="";
|
String profile ="";
|
||||||
managerSec.useCredentials(cred);
|
managerSec.useCredentials(cred);
|
||||||
managerSec.setSecurity(registryFactoryPortType, GCUBESecurityManager.AuthMode.INTEGRITY, GCUBESecurityManager.DelegationMode.NONE);
|
registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope("/gcube/devsec"),managerSec);
|
||||||
try {
|
try {
|
||||||
StringWriter writer =new StringWriter();
|
StringWriter writer =new StringWriter();
|
||||||
resource.store(writer);
|
resource.store(writer);
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.gcube.informationsystem.registry.test;
|
||||||
|
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
|
import org.apache.axis.message.addressing.Address;
|
||||||
|
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||||
|
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||||
|
import org.gcube.common.core.contexts.GHNContext;
|
||||||
|
import org.gcube.common.core.resources.GCUBEService;
|
||||||
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
|
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.RegistryFactoryPortType;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.UpdateProfileMessage;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.service.RegistryFactoryServiceAddressingLocator;
|
||||||
|
import org.gridforum.jgss.ExtendedGSSCredential;
|
||||||
|
|
||||||
|
public class RegistryUpdateTest {
|
||||||
|
|
||||||
|
public static void main (String[]args ) throws Exception {
|
||||||
|
|
||||||
|
RegistryFactoryServiceAddressingLocator registryLocator = new RegistryFactoryServiceAddressingLocator();
|
||||||
|
|
||||||
|
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() { public boolean isSecurityEnabled() {return true;}};
|
||||||
|
|
||||||
|
ExtendedGSSCredential cred =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[2]);
|
||||||
|
|
||||||
|
FileReader fis = new FileReader (args[1]);
|
||||||
|
GCUBEService resource =GHNContext.getImplementation(GCUBEService.class);
|
||||||
|
EndpointReferenceType factoryEPR = new EndpointReferenceType();
|
||||||
|
resource.load(fis);
|
||||||
|
|
||||||
|
|
||||||
|
RegistryFactoryPortType registryFactoryPortType= null;
|
||||||
|
try {
|
||||||
|
factoryEPR.setAddress(new Address(args[0]));
|
||||||
|
registryFactoryPortType = registryLocator.getRegistryFactoryPortTypePort(factoryEPR);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
UpdateProfileMessage message = new UpdateProfileMessage();
|
||||||
|
|
||||||
|
managerSec.useCredentials(cred);
|
||||||
|
|
||||||
|
registryFactoryPortType =GCUBERemotePortTypeContext.getProxy(registryFactoryPortType,GCUBEScope.getScope("/gcube/devsec"),managerSec);
|
||||||
|
try {
|
||||||
|
StringWriter writer =new StringWriter();
|
||||||
|
resource.store(writer);
|
||||||
|
message.setXmlProfile(writer.toString());
|
||||||
|
message.setUniqueID(resource.getID());
|
||||||
|
message.setType(GCUBEService.TYPE);
|
||||||
|
|
||||||
|
registryFactoryPortType.updateResource(message);
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
System.out.println("Profile has been updated");
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,7 +44,7 @@
|
||||||
<!-- RESOURCE PROPERTIES -->
|
<!-- RESOURCE PROPERTIES -->
|
||||||
|
|
||||||
|
|
||||||
<xsd:element name="Profile" type="xsd:string"/>
|
<xsd:element name="Profile" type="xsd:anyType"/>
|
||||||
|
|
||||||
<xsd:element name="NotificationProfile" type="xsd:string"/>
|
<xsd:element name="NotificationProfile" type="xsd:string"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue