Changeset 5928
- Timestamp:
- 01/16/15 14:08:38 (10 years ago)
- Location:
- ComponentRegistry/branches/ComponentRegistry-1.14
- Files:
-
- 1 deleted
- 19 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/ComponentRegistry-1.14
- Property svn:mergeinfo changed
/ComponentRegistry/trunk merged: 5917-5918,5920-5923
- Property svn:mergeinfo changed
-
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentBrowserGui
- Property svn:mergeinfo changed
/ComponentRegistry/trunk/ComponentBrowserGui (added) merged: 5920
- Property svn:mergeinfo changed
-
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ConceptLinkInput.as
r2526 r5928 52 52 53 53 private function createSearchConceptLinkButton():void { 54 searchConceptLink.label = "Search in isocat...";54 searchConceptLink.label = "Search in concept registry..."; 55 55 searchConceptLink.addEventListener(MouseEvent.CLICK, handleButtonClick); 56 56 } -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/IsocatSearchPopUp.mxml
r2126 r5928 5 5 creationComplete="PopUpManager.centerPopUp(this)" 6 6 close="cleanUp();" 7 title="Search in Isocat.org">7 title="Search in CLARIN Concept Registry"> 8 8 9 9 <mx:Metadata> -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ValueSchemePopUp.mxml
r2525 r5928 125 125 <mx:Button label="Use Controlled Vocabulary" 126 126 click="setControlledVocabulary()"/> 127 <mx:Button label="Search in isocat..."127 <mx:Button label="Search in concept registry..." 128 128 click="handleIsocatButtonClick(event)" 129 129 enabled="{enumerationGrid.conceptLinkEdit}"/> -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/Config.as
r5823 r5928 59 59 private static const USER_SETTINGS_URL:String = "/admin/userSettings"; 60 60 private static const COMMENTS_URL_PATH:String = "/comments/"; 61 private static const ISOCAT_SERVLET:String = "/ isocat";61 private static const ISOCAT_SERVLET:String = "/ccr"; 62 62 private static const USER_GROUPS_MEMBERSHIP_URL:String = "/rest/registry/groups/usermembership"; 63 63 -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry
- Property svn:mergeinfo changed
/ComponentRegistry/trunk/ComponentRegistry merged: 5917-5918,5921-5923
- Property svn:mergeinfo changed
-
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/java
- Property svn:mergeinfo changed
/ComponentRegistry/trunk/ComponentRegistry/src/main/java merged: 5917-5918,5921,5923
- Property svn:mergeinfo changed
-
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/ComponentRegistry.java
r5874 r5928 249 249 250 250 Number makeGroupMember(String principalName, String groupName) throws UserUnauthorizedException, ItemNotFoundException; 251 252 boolean canCurrentUserAccessDescription(String cmdId) throws ItemNotFoundException, AuthenticationRequiredException; 251 253 252 254 //long removeGroupMember(String principalName, String groupName) throws UserUnauthorizedException, ItemNotFoundException; -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/Configuration.java
r5549 r5928 19 19 public class Configuration { 20 20 21 private static Logger LOG = LoggerFactory.getLogger(Configuration.class);21 private final static Logger LOG = LoggerFactory.getLogger(Configuration.class); 22 22 //NOTE: Default values, can be overwritten in applicationContext.xml 23 23 private String generalComponentSchema = "https://infra.clarin.eu/cmd/general-component-schema.xsd"; 24 24 private String component2SchemaXsl = "https://infra.clarin.eu/cmd/xslt/comp2schema-v2/comp2schema.xsl";//"http://www.clarin.eu/cmd/comp2schema.xsl"; 25 private String isocatRestUrl = "http://www.isocat.org/rest/";25 private String ccrRestUrl = "https://openskos.meertens.knaw.nl/ccr/api/"; 26 26 private Collection<String> adminUsers = new HashSet<String>(); 27 27 private List<String> displayNameShibbolethKeys = new ArrayList<String>(); 28 28 29 29 {//Default values 30 31 30 displayNameShibbolethKeys.add("displayName"); 31 displayNameShibbolethKeys.add("commonName"); 32 32 } 33 private Map<String, String> schemaLocations = new HashMap<String, String>();33 private final Map<String, String> schemaLocations = new HashMap<String, String>(); 34 34 35 35 {//Default values 36 37 36 schemaLocations.put(CMDComponentSpec.class.getName(), 37 "http://www.clarin.eu/cmd/ http://infra.clarin.eu/cmd/general-component-schema.xsd"); 38 38 } 39 39 private final static Configuration INSTANCE = new Configuration(); … … 43 43 44 44 public static Configuration getInstance() { 45 45 return INSTANCE; 46 46 } 47 47 48 48 public String getComponent2SchemaXsl() { 49 49 return component2SchemaXsl; 50 50 } 51 51 52 52 public List<String> getDisplayNameShibbolethKeys() { 53 53 return displayNameShibbolethKeys; 54 54 } 55 55 56 56 public String getGeneralComponentSchema() { 57 57 return generalComponentSchema; 58 58 } 59 59 60 public String get IsocatRestUrl() {61 return isocatRestUrl;60 public String getCcrRestUrl() { 61 return ccrRestUrl; 62 62 } 63 63 64 64 public String getSchemaLocation(String key) { 65 65 return schemaLocations.get(key); 66 66 } 67 67 68 68 public boolean isAdminUser(Principal principal) { 69 70 71 72 73 69 if (principal != null) { 70 return principal.getName().trim().length() > 0 // user name must be set (in case an empty entry is in admin users list) 71 && adminUsers.contains(principal.getName()); 72 } 73 return false; 74 74 } 75 75 76 76 public boolean isAdminUser(String name) { 77 78 79 80 81 77 if (name != null) { 78 return name.trim().length() > 0 // user name must be set (in case an empty entry is in admin users list) 79 && adminUsers.contains(name); 80 } 81 return false; 82 82 } 83 83 84 84 public void setAdminUsers(Collection<String> adminUsers) { 85 86 85 LOG.debug("Setting adminUsers to {}", Arrays.toString(adminUsers.toArray())); 86 this.adminUsers = adminUsers; 87 87 } 88 89 88 90 89 /** 91 90 * … … 93 92 */ 94 93 public void setAdminUsersList(String adminUsersList) { 95 96 97 98 99 94 String[] adminUsersArray = adminUsersList.trim().split("\\s+"); 95 if (LOG.isDebugEnabled()) { 96 LOG.info("Setting adminUsersList to {}", Arrays.toString(adminUsersArray)); 97 } 98 setAdminUsers(Arrays.asList(adminUsersArray)); 100 99 } 101 100 102 101 public void setComponent2SchemaXsl(String component2SchemaXsl) { 103 104 102 LOG.info("Setting component2SchemaXsl to {}", component2SchemaXsl); 103 this.component2SchemaXsl = component2SchemaXsl; 105 104 } 106 105 107 106 public void setComponentSpecSchemaLocation(String componentSpecSchemaLocation) { 108 109 107 LOG.info("Setting componentSpecSchemaLocation to {}", componentSpecSchemaLocation); 108 schemaLocations.put(CMDComponentSpec.class.getName(), componentSpecSchemaLocation); 110 109 } 111 110 112 111 public void setDisplayNameShibbolethKeys(List<String> displayNameShibbolethKeys) { 113 114 112 LOG.info("Setting displayNameShibbolethKeys to {}", displayNameShibbolethKeys); 113 this.displayNameShibbolethKeys = displayNameShibbolethKeys; 115 114 } 116 115 117 116 public void setGeneralComponentSchema(String generalComponentSchema) { 118 119 117 LOG.info("Setting generalComponentSchema to {}", generalComponentSchema); 118 this.generalComponentSchema = generalComponentSchema; 120 119 } 121 120 122 public void set IsocatRestUrl(String isocatRestUrl) {123 LOG.info("Setting isocatRestUrl to {}", isocatRestUrl);124 this.isocatRestUrl = isocatRestUrl;121 public void setCcrRestUrl(String ccrRestUrl) { 122 LOG.info("Setting ccrRestUrl to {}", ccrRestUrl); 123 this.ccrRestUrl = ccrRestUrl; 125 124 } 126 125 127 126 public String[] getAdminUsersArray() { 128 127 return adminUsers.toArray(new String[0]); 129 128 } 130 129 } -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/MDMarshaller.java
r3091 r5928 4 4 import java.io.ByteArrayInputStream; 5 5 import java.io.ByteArrayOutputStream; 6 import java.io.File;7 import java.io.FileInputStream;8 import java.io.IOException;9 6 import java.io.InputStream; 10 7 import java.io.OutputStream; -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java
r5874 r5928 800 800 } 801 801 802 private boolean canCurrentUserAccessDescription(String cmdId) throws ItemNotFoundException, AuthenticationRequiredException { 802 @Override 803 public boolean canCurrentUserAccessDescription(String cmdId) throws ItemNotFoundException, AuthenticationRequiredException { 803 804 if (cmdId == null) { 804 805 throw new ItemNotFoundException("Item with the null cmdIdentifier."); -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r5874 r5928 368 368 try { 369 369 registry.getMDComponentAsXml(componentId, output); 370 } catch (ItemNotFoundException e 1) {371 LOG.warn("Could not retrieve component {} ",372 componentId );373 LOG.debug("Details", e 1);374 throw new WebApplicationException( e1,Response370 } catch (ItemNotFoundException e) { 371 LOG.warn("Could not retrieve component {}: {}", 372 componentId, e.getMessage()); 373 LOG.debug("Details", e); 374 throw new WebApplicationException(Response 375 375 .serverError() 376 376 .status(Status.INTERNAL_SERVER_ERROR) … … 378 378 } 379 379 } catch (ComponentRegistryException e) { 380 LOG.warn("Could not retrieve component {} ",381 componentId );380 LOG.warn("Could not retrieve component {}: {}", 381 componentId, e.getMessage()); 382 382 LOG.debug("Details", e); 383 throw new WebApplicationException( e,Response383 throw new WebApplicationException(Response 384 384 .serverError() 385 385 .status(Status.INTERNAL_SERVER_ERROR) … … 402 402 try { 403 403 registry.getMDComponentAsXsd(componentId, output); 404 } catch (ItemNotFoundException e 1) {405 LOG.warn("Could not retrieve component {} ",406 componentId );407 LOG.debug("Details", e 1);408 throw new WebApplicationException( e1,Response404 } catch (ItemNotFoundException e) { 405 LOG.warn("Could not retrieve component {}: {}", 406 componentId, e.getMessage()); 407 LOG.debug("Details", e); 408 throw new WebApplicationException(Response 409 409 .serverError() 410 410 .status(Status.INTERNAL_SERVER_ERROR) … … 412 412 } 413 413 } catch (ComponentRegistryException e) { 414 LOG.warn("Could not retrieve component {} ",415 componentId );414 LOG.warn("Could not retrieve component {}: {}", 415 componentId, e.getMessage()); 416 416 LOG.debug("Details", e); 417 throw new WebApplicationException( e,Response417 throw new WebApplicationException(Response 418 418 .serverError() 419 419 .status(Status.INTERNAL_SERVER_ERROR) … … 1196 1196 registry.getMDProfileAsXml(profileId, output); 1197 1197 } catch (Exception e) { 1198 LOG.warn("Could not retrieve component {} ",1199 profileId );1198 LOG.warn("Could not retrieve component {}: {}", 1199 profileId, e.getMessage()); 1200 1200 LOG.debug("Details", e); 1201 throw new WebApplicationException( e,Response1201 throw new WebApplicationException(Response 1202 1202 .serverError() 1203 1203 .status(Status.INTERNAL_SERVER_ERROR) … … 1214 1214 registry.getMDProfileAsXsd(profileId, output); 1215 1215 } catch (Exception e) { 1216 LOG.warn("Could not retrieve component {} ",1217 profileId );1216 LOG.warn("Could not retrieve component {}: {}", 1217 profileId, e.getMessage()); 1218 1218 LOG.debug("Details", e); 1219 throw new WebApplicationException( e,Response1219 throw new WebApplicationException(Response 1220 1220 .serverError() 1221 1221 .status(Status.INTERNAL_SERVER_ERROR) -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/MDValidator.java
r5549 r5928 1 1 package clarin.cmdi.componentregistry.rest; 2 2 3 import clarin.cmdi.componentregistry.AuthenticationRequiredException; 3 4 import clarin.cmdi.componentregistry.ComponentRegistry; 4 5 import clarin.cmdi.componentregistry.ComponentRegistryException; … … 12 13 import clarin.cmdi.componentregistry.components.CMDComponentSpec; 13 14 import clarin.cmdi.componentregistry.components.CMDComponentType; 15 import clarin.cmdi.componentregistry.impl.database.GroupService; 14 16 import clarin.cmdi.componentregistry.model.BaseDescription; 15 17 import clarin.cmdi.schema.cmd.Validator.Message; … … 39 41 static final String SCHEMA_ERROR = "Error in reading general component schema: "; 40 42 static final String IO_ERROR = "Error while reading specification or general component schema: "; 43 static final String INTERNAL_ERROR = "Internal error: "; 41 44 static final String COMPONENT_NOT_REGISTERED_IN_APPROPRIATE_SPACE_ERROR = "referenced component cannot be found in the appropriate registry components: "; 42 45 static final String COMPONENT_REGISTRY_EXCEPTION_ERROR = "An exception occurred while accessing the component registry: "; … … 119 122 } catch (NullIdException e3) { 120 123 errorMessages.add(COMPONENT_NOT_REGISTERED_ERROR + e3); 124 } catch(AuthenticationRequiredException e) { 125 errorMessages.add(INTERNAL_ERROR + e); 121 126 } 122 127 } … … 136 141 } 137 142 138 private void validateComponents(CMDComponentSpec componentSpec) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException, NullIdException {143 private void validateComponents(CMDComponentSpec componentSpec) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException, NullIdException, AuthenticationRequiredException { 139 144 validateComponents(Collections.singletonList(componentSpec.getCMDComponent())); 140 145 } 141 146 142 private void validateComponents(List<CMDComponentType> cmdComponents) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException, NullIdException {147 private void validateComponents(List<CMDComponentType> cmdComponents) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException, NullIdException, AuthenticationRequiredException { 143 148 for (CMDComponentType cmdComponentType : cmdComponents) { 144 149 this.validateDescribedComponents(cmdComponentType); … … 147 152 } 148 153 149 private void validateDescribedComponents(CMDComponentType cmdComponentType) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException, NullIdException {154 private void validateDescribedComponents(CMDComponentType cmdComponentType) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException, NullIdException, AuthenticationRequiredException { 150 155 this.checkComponentInSpace(cmdComponentType); 151 156 } 152 157 153 private void checkComponentInSpace(CMDComponentType cmdComponentType) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException, NullIdException {158 private void checkComponentInSpace(CMDComponentType cmdComponentType) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException, NullIdException, AuthenticationRequiredException { 154 159 if (isDefinedInSeparateFile(cmdComponentType)) { 155 160 String id = cmdComponentType.getComponentId(); … … 160 165 CMDComponentSpec registeredComponent = registry.getMDComponent(id); 161 166 if (registeredComponent != null) { 162 String componentId = cmdComponentType.getComponentId(); 163 Boolean isPublicB = registry.isItemPublic(id);// throws ItemNotFoundException 164 boolean isPublic = isPublicB.booleanValue(); 165 if (isPublic) { // if a component is public, it is available for any registry 167 final String componentId = cmdComponentType.getComponentId(); 168 if (registry.isItemPublic(id)) { // if a component is public, it is available for any registry 166 169 return; 167 170 }; 168 171 // a private component for a private registry is available only if its owner is the owner of the resgitry 169 172 if (registry.getRegistrySpace().equals(RegistrySpace.PRIVATE)) { 170 Number registryOwnerId = registry.getRegistryOwner().getId(); 171 Number componentOwnerId = registry.getBaseDescriptionOwnerId(cmdComponentType.getComponentId()); 172 if (registryOwnerId.equals(componentOwnerId)) { 173 if(registry.canCurrentUserAccessDescription(componentId)) { 173 174 return; 174 } ;175 } 175 176 errorMessages.add(COMPONENT_NOT_REGISTERED_IN_APPROPRIATE_SPACE_ERROR + componentId + " (private registry)"); 176 177 return; -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/resources/spring-config/applicationContext.xml
r5549 r5928 51 51 <property name="componentSpecSchemaLocation" 52 52 value="${eu.clarin.cmdi.componentregistry.componentSpecSchemaLocation}" /> 53 <property name=" isocatRestUrl"54 value="${eu.clarin.cmdi.componentregistry. isocatRestUrl}" />53 <property name="ccrRestUrl" 54 value="${eu.clarin.cmdi.componentregistry.ccrRestUrl}" /> 55 55 <!-- Extra attribute keys that are passed in a shibboleth authenticated 56 56 request principal. You need to configure the shhaa.xml file to enable the … … 113 113 <prop key="hibernate.dialect">${eu.clarin.cmdi.componentregistry.jpaDialect}</prop> 114 114 <prop key="hibernate.show_sql">false</prop> 115 <prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop> 115 116 <!-- prop key="hibernate.hbm2ddl.auto">update</prop --> 116 117 </props> -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/webapp/META-INF/context.xml
r5549 r5928 67 67 Base location of the ISOcat service 68 68 --> 69 <Parameter name="eu.clarin.cmdi.componentregistry. isocatRestUrl" value="https://catalog.clarin.eu/isocat/rest/"/>69 <Parameter name="eu.clarin.cmdi.componentregistry.ccrRestUrl" value="https://openskos.meertens.knaw.nl/ccr/api/"/> 70 70 <Parameter name="eu.clarin.cmdi.componentregistry.jpaDialect" value="org.hibernate.dialect.PostgreSQLDialect"/> 71 71 </Context> -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/webapp/WEB-INF/web-shib.xml
r5834 r5928 102 102 103 103 <servlet> 104 <servlet-name> IsocatServlet</servlet-name>105 <servlet-class>clarin.cmdi.componentregistry.servlet. IsocatServlet</servlet-class>104 <servlet-name>Concept Registry Servlet</servlet-name> 105 <servlet-class>clarin.cmdi.componentregistry.servlet.ConceptRegistryServlet</servlet-class> 106 106 <load-on-startup>1</load-on-startup> 107 107 </servlet> 108 108 <servlet-mapping> 109 <servlet-name> IsocatServlet</servlet-name>110 <url-pattern>/ isocat/*</url-pattern>109 <servlet-name>Concept Registry Servlet</servlet-name> 110 <url-pattern>/ccr/*</url-pattern> 111 111 </servlet-mapping> 112 112 <servlet> -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/main/webapp/WEB-INF/web-test.xml
r5834 r5928 76 76 <servlet-name>ComponentRegistry Web Application</servlet-name> 77 77 <url-pattern>/rest/*</url-pattern> 78 </servlet-mapping> 78 </servlet-mapping> 79 79 80 <servlet> 80 <servlet-name>Isocat Servlet</servlet-name> 81 <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet 82 </servlet-class> 81 <servlet-name>Concept Registry Servlet</servlet-name> 82 <servlet-class>clarin.cmdi.componentregistry.servlet.ConceptRegistryServlet</servlet-class> 83 83 <load-on-startup>1</load-on-startup> 84 84 </servlet> 85 85 <servlet-mapping> 86 <servlet-name> IsocatServlet</servlet-name>87 <url-pattern>/ isocat/*</url-pattern>86 <servlet-name>Concept Registry Servlet</servlet-name> 87 <url-pattern>/ccr/*</url-pattern> 88 88 </servlet-mapping> 89 89 90 <servlet> 90 91 <servlet-name>JerseyJaxrsConfig</servlet-name> -
ComponentRegistry/branches/ComponentRegistry-1.14/ComponentRegistry/src/test/resources/spring-config/component-registry.properties
r4680 r5928 3 3 eu.clarin.cmdi.componentregistry.component2SchemaXslUrl=https://infra.clarin.eu/cmd/xslt/comp2schema-v2/comp2schema.xsl 4 4 eu.clarin.cmdi.componentregistry.componentSpecSchemaLocation=http://www.clarin.eu/cmd http://lux16.mpi.nl/general-component-schema.xsd 5 eu.clarin.cmdi.componentregistry. isocatRestUrl=https://catalog.clarin.eu/isocat/rest/5 eu.clarin.cmdi.componentregistry.ccrRestUrl=https://openskos.meertens.knaw.nl/ccr/api/ 6 6 eu.clarin.cmdi.componentregistry.jpaDialect=org.hibernate.dialect.HSQLDialect
Note: See TracChangeset
for help on using the changeset viewer.