merging from branch 2.0
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@35557 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1a4ab52a41
commit
9c271345c2
|
@ -5,9 +5,8 @@
|
||||||
<classpathentry kind="src" path="test"/>
|
<classpathentry kind="src" path="test"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/GCORELIBS"/>
|
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/GCORELIBS"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/DISTRO.RESOURCES"/>
|
|
||||||
<classpathentry kind="lib" path="/Dependencies/ISREGISTRY/org.gcube.informationsystem.registry.stubs.jar"/>
|
<classpathentry kind="lib" path="/Dependencies/ISREGISTRY/org.gcube.informationsystem.registry.stubs.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/GCF.TRUNK"/>
|
|
||||||
<classpathentry kind="lib" path="/Dependencies/ISCollector/org.gcube.informationsystem.collector.stubs.jar"/>
|
<classpathentry kind="lib" path="/Dependencies/ISCollector/org.gcube.informationsystem.collector.stubs.jar"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/GCF.1.1.0"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
10
.fbprefs
10
.fbprefs
|
@ -1,5 +1,5 @@
|
||||||
#FindBugs User Preferences
|
#FindBugs User Preferences
|
||||||
#Tue Nov 04 12:23:33 CET 2008
|
#Wed Mar 02 12:43:11 EST 2011
|
||||||
detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
|
detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
|
||||||
detectorBadAppletConstructor=BadAppletConstructor|false
|
detectorBadAppletConstructor=BadAppletConstructor|false
|
||||||
detectorBadResultSetAccess=BadResultSetAccess|true
|
detectorBadResultSetAccess=BadResultSetAccess|true
|
||||||
|
@ -17,12 +17,14 @@ detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOute
|
||||||
detectorCrossSiteScripting=CrossSiteScripting|true
|
detectorCrossSiteScripting=CrossSiteScripting|true
|
||||||
detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
|
detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
|
||||||
detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
|
detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
|
||||||
|
detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true
|
||||||
detectorDontUseEnum=DontUseEnum|true
|
detectorDontUseEnum=DontUseEnum|true
|
||||||
detectorDroppedException=DroppedException|true
|
detectorDroppedException=DroppedException|true
|
||||||
detectorDumbMethodInvocations=DumbMethodInvocations|true
|
detectorDumbMethodInvocations=DumbMethodInvocations|true
|
||||||
detectorDumbMethods=DumbMethods|true
|
detectorDumbMethods=DumbMethods|true
|
||||||
detectorDuplicateBranches=DuplicateBranches|true
|
detectorDuplicateBranches=DuplicateBranches|true
|
||||||
detectorEmptyZipFileEntry=EmptyZipFileEntry|true
|
detectorEmptyZipFileEntry=EmptyZipFileEntry|true
|
||||||
|
detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true
|
||||||
detectorFinalizerNullsFields=FinalizerNullsFields|true
|
detectorFinalizerNullsFields=FinalizerNullsFields|true
|
||||||
detectorFindBadCast2=FindBadCast2|true
|
detectorFindBadCast2=FindBadCast2|true
|
||||||
detectorFindBadForLoop=FindBadForLoop|true
|
detectorFindBadForLoop=FindBadForLoop|true
|
||||||
|
@ -81,6 +83,7 @@ detectorInvalidJUnitTest=InvalidJUnitTest|true
|
||||||
detectorIteratorIdioms=IteratorIdioms|true
|
detectorIteratorIdioms=IteratorIdioms|true
|
||||||
detectorLazyInit=LazyInit|true
|
detectorLazyInit=LazyInit|true
|
||||||
detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
|
detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
|
||||||
|
detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true
|
||||||
detectorMethodReturnCheck=MethodReturnCheck|true
|
detectorMethodReturnCheck=MethodReturnCheck|true
|
||||||
detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
|
detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
|
||||||
detectorMutableLock=MutableLock|true
|
detectorMutableLock=MutableLock|true
|
||||||
|
@ -91,6 +94,7 @@ detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
|
||||||
detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
|
detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
|
||||||
detectorPublicSemaphores=PublicSemaphores|false
|
detectorPublicSemaphores=PublicSemaphores|false
|
||||||
detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
|
detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
|
||||||
|
detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true
|
||||||
detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
|
detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
|
||||||
detectorRedundantInterfaces=RedundantInterfaces|true
|
detectorRedundantInterfaces=RedundantInterfaces|true
|
||||||
detectorRepeatedConditionals=RepeatedConditionals|true
|
detectorRepeatedConditionals=RepeatedConditionals|true
|
||||||
|
@ -118,6 +122,6 @@ detectorWrongMapIterator=WrongMapIterator|true
|
||||||
detectorXMLFactoryBypass=XMLFactoryBypass|true
|
detectorXMLFactoryBypass=XMLFactoryBypass|true
|
||||||
detector_threshold=2
|
detector_threshold=2
|
||||||
effort=default
|
effort=default
|
||||||
filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false
|
filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false
|
||||||
filter_settings_neg=|
|
filter_settings_neg=NOISE|
|
||||||
run_at_full_build=true
|
run_at_full_build=true
|
||||||
|
|
7
README
7
README
|
@ -18,7 +18,7 @@ Authors
|
||||||
|
|
||||||
Version and Release Date
|
Version and Release Date
|
||||||
------------------------
|
------------------------
|
||||||
v. 1.3.3 (14-5-2010)
|
v. 2.0.0 (07-02-2011)
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
@ -33,15 +33,14 @@ Source code is available from SVN:
|
||||||
http://svn.d4science.research-infrastructures.eu/gcube/trunk/
|
http://svn.d4science.research-infrastructures.eu/gcube/trunk/
|
||||||
|
|
||||||
Binaries can be downloaded from:
|
Binaries can be downloaded from:
|
||||||
http://software.d4science.research-infrastructures.eu/
|
https://www.gcube-system.org/index.php?option=com_content&view=article&id=290&Itemid=48
|
||||||
|
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
Documentation is available on-line from the Projects Documentation Wiki:
|
Documentation is available on-line from the Projects Documentation Wiki:
|
||||||
|
|
||||||
https://technical.wiki.d4science.research-infrastructures.eu/documentation/index.php/IS-Registry
|
https://gcube.wiki.gcube-system.org/gcube/index.php/IS-Registry
|
||||||
|
|
||||||
|
|
||||||
Licensing
|
Licensing
|
||||||
---------
|
---------
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
package org.gcube.informationsystem.registry.impl.porttypes;
|
package org.gcube.informationsystem.registry.impl.porttypes;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.StringReader;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import org.apache.axis.components.uuid.UUIDGen;
|
|
||||||
import org.apache.axis.components.uuid.UUIDGenFactory;
|
|
||||||
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||||
import org.gcube.common.core.contexts.GCUBEServiceContext.Status;
|
import org.gcube.common.core.contexts.GCUBEServiceContext.Status;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
import org.gcube.common.core.faults.GCUBEFault;
|
||||||
|
@ -21,8 +13,6 @@ import org.gcube.common.core.utils.logging.GCUBELog;
|
||||||
import org.gcube.informationsystem.registry.impl.contexts.FactoryContext;
|
import org.gcube.informationsystem.registry.impl.contexts.FactoryContext;
|
||||||
import org.gcube.informationsystem.registry.impl.contexts.ProfileContext;
|
import org.gcube.informationsystem.registry.impl.contexts.ProfileContext;
|
||||||
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
||||||
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext.RegistryTopic;
|
|
||||||
import org.gcube.informationsystem.registry.impl.local.LocalNotifier;
|
|
||||||
import org.gcube.informationsystem.registry.impl.state.ProfileResource;
|
import org.gcube.informationsystem.registry.impl.state.ProfileResource;
|
||||||
import org.gcube.informationsystem.registry.impl.state.RegistryFactoryResource;
|
import org.gcube.informationsystem.registry.impl.state.RegistryFactoryResource;
|
||||||
import org.gcube.informationsystem.registry.impl.state.Definitions.OperationType;
|
import org.gcube.informationsystem.registry.impl.state.Definitions.OperationType;
|
||||||
|
@ -35,6 +25,9 @@ import org.gcube.informationsystem.registry.stubs.ResourceNotAcceptedFault;
|
||||||
import org.gcube.informationsystem.registry.stubs.SchemaValidationFault;
|
import org.gcube.informationsystem.registry.stubs.SchemaValidationFault;
|
||||||
import org.gcube.informationsystem.registry.stubs.UpdateResourceMessage;
|
import org.gcube.informationsystem.registry.stubs.UpdateResourceMessage;
|
||||||
import org.gcube.informationsystem.registry.stubs.UpdateResourceResponse;
|
import org.gcube.informationsystem.registry.stubs.UpdateResourceResponse;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.resourceregistration.CreateMessage;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.resourceregistration.RemoveMessage;
|
||||||
|
import org.gcube.informationsystem.registry.stubs.resourceregistration.UpdateMessage;
|
||||||
|
|
||||||
import static org.gcube.informationsystem.registry.impl.state.Definitions.ResourceType;
|
import static org.gcube.informationsystem.registry.impl.state.Definitions.ResourceType;
|
||||||
|
|
||||||
|
@ -47,9 +40,6 @@ import static org.gcube.informationsystem.registry.impl.state.Definitions.Resour
|
||||||
public class RegistryFactory extends GCUBEPortType {
|
public class RegistryFactory extends GCUBEPortType {
|
||||||
|
|
||||||
|
|
||||||
/** The UUIDGen */
|
|
||||||
private static final UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();
|
|
||||||
|
|
||||||
/** Object logger */
|
/** Object logger */
|
||||||
protected static final GCUBELog logger = new GCUBELog(RegistryFactory.class);
|
protected static final GCUBELog logger = new GCUBELog(RegistryFactory.class);
|
||||||
|
|
||||||
|
@ -117,63 +107,17 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
public String createResource(CreateResourceMessage mess)
|
public String createResource(CreateResourceMessage mess)
|
||||||
throws SchemaValidationFault, RemoteException, ProfileAlreadyRegisteredFault, ResourceNotAcceptedFault {
|
throws SchemaValidationFault, RemoteException, ProfileAlreadyRegisteredFault, ResourceNotAcceptedFault {
|
||||||
|
|
||||||
GCUBEResource resource = null;
|
|
||||||
|
|
||||||
logger.info("CreateResource operation invoked in scope " + ServiceContext.getContext().getScope());
|
logger.info("CreateResource operation invoked in scope " + ServiceContext.getContext().getScope());
|
||||||
// logSecurityInfo("createResource");
|
|
||||||
|
|
||||||
String profile = mess.getProfile();
|
|
||||||
if (profile == null || profile.compareTo("") == 0) {
|
|
||||||
String msg = "Profile file is empty";
|
|
||||||
logger.debug(msg);
|
|
||||||
throw new RemoteException(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resource = ResourceType.valueOf(mess.getType()).getResourceClass();
|
ResourceRegistration registration = new ResourceRegistration();
|
||||||
resource.load(new BufferedReader(new InputStreamReader( new ByteArrayInputStream(profile.getBytes("UTF-8")),"UTF-8")));
|
CreateMessage message = new CreateMessage(mess.getProfile(), mess.getType());
|
||||||
|
registration.create(message);
|
||||||
// the parse Profile class allows to extract from profiles
|
|
||||||
// information about type/SCOPE/UniqueID
|
|
||||||
// in order to distinguish among different Resource Type
|
|
||||||
// Adding scopes to Profile
|
|
||||||
String[] scopes = mess.getScopes();
|
|
||||||
if (scopes != null) {
|
|
||||||
for (String scope : scopes) {
|
|
||||||
logger.debug(resource.getID() + " Adding Scopes to Profile " + scope);
|
|
||||||
resource.addScope(GCUBEScope.getScope(scope));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// check ID
|
|
||||||
if (resource.getID() == null || resource.getID().compareTo("") == 0) {
|
|
||||||
resource.setID(uuidgen.nextUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
logger.error("Error trying to load profile", ex);
|
|
||||||
throw new SchemaValidationFault();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
updateCounterInfo(resource.getID(), ResourceType.valueOf(
|
|
||||||
mess.getType()), OperationType.create,
|
|
||||||
Calendar.getInstance(), mess.getProfile());
|
|
||||||
|
|
||||||
LocalNotifier.notifyEvent(resource, RegistryTopic.CREATE);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Error updating Counting info for resource with ID " + resource.getID(), e);
|
logger.error("", e);
|
||||||
|
throw new ResourceNotAcceptedFault();
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
|
|
||||||
StringWriter writer = new StringWriter();
|
|
||||||
try {
|
|
||||||
resource.store(writer);
|
|
||||||
logger.info("Profile " + resource.getID() + " created ");
|
|
||||||
return writer.toString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Persistence failed for " + resource.getID(), e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,35 +134,16 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
public UpdateResourceResponse updateResource(UpdateResourceMessage mess)
|
public UpdateResourceResponse updateResource(UpdateResourceMessage mess)
|
||||||
throws RemoteException, SchemaValidationFault, ResourceNotAcceptedFault, GCUBEFault {
|
throws RemoteException, SchemaValidationFault, ResourceNotAcceptedFault, GCUBEFault {
|
||||||
|
|
||||||
logger.info("UpdateResource operation invoked");
|
logger.info("UpdateResource operation invoked in scope " + ServiceContext.getContext().getScope());
|
||||||
String ID = mess.getUniqueID();
|
|
||||||
String xmlProfile = mess.getXmlProfile();
|
|
||||||
GCUBEResource resource = null;
|
|
||||||
// validating input parameters
|
|
||||||
if (ID == null || ID.compareTo("") == 0) {
|
|
||||||
logger.debug(" ID missing ");
|
|
||||||
throw new RemoteException("Error, ID missing");
|
|
||||||
}
|
|
||||||
if (xmlProfile == null || xmlProfile.compareTo("") == 0) {
|
|
||||||
logger.debug("Profile missing");
|
|
||||||
throw new RemoteException("Error, profile missing");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
resource = ResourceType.valueOf(mess.getType()).getResourceClass();
|
|
||||||
resource.load(new StringReader(xmlProfile));
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Error updating profile for ID " + e);
|
|
||||||
throw new RemoteException(e.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
updateCounterInfo(ID, ResourceType.valueOf(mess.getType()),
|
ResourceRegistration registration = new ResourceRegistration();
|
||||||
OperationType.update, Calendar.getInstance(), xmlProfile);
|
UpdateMessage message = new UpdateMessage(mess.getType(), mess.getUniqueID(), mess.getXmlProfile());
|
||||||
LocalNotifier.notifyEvent(resource, RegistryTopic.UPDATE);
|
registration.update(message);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Error while updating the counting info for resource with ID " + resource.getID(), e);
|
logger.error("", e);
|
||||||
|
throw new ResourceNotAcceptedFault();
|
||||||
}
|
}
|
||||||
logger.info("Profile " + mess.getUniqueID() + " updated");
|
|
||||||
return new UpdateResourceResponse();
|
return new UpdateResourceResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,26 +156,18 @@ public class RegistryFactory extends GCUBEPortType {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public RemoveResourceResponse removeResource(
|
public RemoveResourceResponse removeResource(
|
||||||
RemoveResourceMessage inputMessage) throws RemoteException, GCUBEFault {
|
RemoveResourceMessage mess) throws RemoteException, GCUBEFault {
|
||||||
|
|
||||||
|
logger.info("RemoveResource operation invoked in scope " + ServiceContext.getContext().getScope());
|
||||||
|
|
||||||
String ID = inputMessage.getUniqueID();
|
|
||||||
String type = inputMessage.getType();
|
|
||||||
logger.info("RemoveResource operation invoked on resource ID=" + ID + ", type=" + type);
|
|
||||||
if (ID == null || ID.compareTo("") == 0) {
|
|
||||||
logger.warn("Resource ID is missing, cannot manage the resource");
|
|
||||||
throw new RemoteException("Resource ID is missing, cannot manage the resource");
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
GCUBEResource resource = ResourceType.valueOf(type).getResourceClass();
|
ResourceRegistration registration = new ResourceRegistration();
|
||||||
resource.setID(ID);
|
RemoveMessage message = new RemoveMessage(mess.getType(), mess.getUniqueID());
|
||||||
LocalNotifier.notifyEvent(resource, RegistryTopic.REMOVE);
|
registration.remove(message);
|
||||||
updateCounterInfo(ID, ResourceType.valueOf(type),OperationType.destroy, Calendar.getInstance(), null);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn(
|
logger.error("", e);
|
||||||
"Error updating counting info for resource with ID "
|
throw new RemoteException();
|
||||||
+ ID, e);
|
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
return new RemoveResourceResponse();
|
return new RemoveResourceResponse();
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class ResourceRegistration extends GCUBEPortType {
|
||||||
try {
|
try {
|
||||||
resource = ResourceType.valueOf(type).getResourceClass();
|
resource = ResourceType.valueOf(type).getResourceClass();
|
||||||
resource.load(new BufferedReader(new InputStreamReader( new ByteArrayInputStream(profile.getBytes("UTF-8")),"UTF-8")));
|
resource.load(new BufferedReader(new InputStreamReader( new ByteArrayInputStream(profile.getBytes("UTF-8")),"UTF-8")));
|
||||||
resource.addScope(ServiceContext.getContext().getScope());
|
//resource.addScope(ServiceContext.getContext().getScope());
|
||||||
|
|
||||||
// check the ID
|
// check the ID
|
||||||
if (resource.getID() == null || resource.getID().compareTo("") == 0) {
|
if (resource.getID() == null || resource.getID().compareTo("") == 0) {
|
||||||
|
|
Loading…
Reference in New Issue