Changeset 1631
- Timestamp:
- 11/28/11 15:46:02 (12 years ago)
- Location:
- ComponentRegistry/branches/jeaferversion
- Files:
-
- 5 added
- 25 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/pom.xml
r1573 r1631 28 28 </profile> 29 29 </profiles> 30 30 31 31 <dependencies> 32 32 <dependency> -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/Browse.mxml
r1092 r1631 13 13 <mx:Script> 14 14 <![CDATA[ 15 import clarin.cmdi.componentregistry.browser.BrowserSelectionEvent; 16 import clarin.cmdi.componentregistry.common.CommentDescription; 17 import clarin.cmdi.componentregistry.common.ItemDescription; 18 import clarin.cmdi.componentregistry.common.Profile; 19 import clarin.cmdi.componentregistry.common.components.BrowseContextMenu; 20 import clarin.cmdi.componentregistry.common.components.RegistryViewStack; 15 21 import clarin.cmdi.componentregistry.services.BrowserService; 22 import clarin.cmdi.componentregistry.services.ComponentInfoService; 23 import clarin.cmdi.componentregistry.services.ComponentListService; 16 24 import clarin.cmdi.componentregistry.services.Config; 17 import clarin.cmdi.componentregistry.services. ComponentInfoService;25 import clarin.cmdi.componentregistry.services.DeleteService; 18 26 import clarin.cmdi.componentregistry.services.ProfileInfoService; 19 27 import clarin.cmdi.componentregistry.services.ProfileListService; 28 import clarin.cmdi.componentregistry.services.CommentInfoService; 29 import clarin.cmdi.componentregistry.services.CommentListService; 30 31 import mx.collections.ArrayCollection; 32 import mx.controls.Alert; 20 33 import mx.events.CollectionEvent; 21 import mx.collections.ArrayCollection;22 import clarin.cmdi.componentregistry.common.components.RegistryViewStack;23 import clarin.cmdi.componentregistry.common.components.BrowseContextMenu;24 import clarin.cmdi.componentregistry.services.DeleteService;25 import clarin.cmdi.componentregistry.services.ComponentListService;26 import clarin.cmdi.componentregistry.common.ItemDescription;27 import mx.controls.Alert;28 import clarin.cmdi.componentregistry.browser.BrowserSelectionEvent;29 import clarin.cmdi.componentregistry.common.Profile;30 34 31 35 public static const START_ITEM_LOADED:String = "startItemLoaded"; … … 38 42 private var profilesSrv:ProfileListService = ProfileListService.getInstance(Config.instance.userSpace); 39 43 [Bindable] 44 private var commentsSrv:CommentListService = CommentListService.getInstance(Config.instance.userSpace); 45 [Bindable] 40 46 private var profileSrv:ProfileInfoService = new ProfileInfoService(); 41 47 [Bindable] 42 48 private var componentSrv:ComponentInfoService = new ComponentInfoService(); 49 [Bindable] 50 private var commentSrv:CommentInfoService = new CommentInfoService(); 43 51 44 52 private var deleteSrv:DeleteService = DeleteService.instance; … … 52 60 [Bindable] 53 61 private var selectedComponentItem:ItemDescription; 62 [Bindable] 63 private var selectedCommentItem:CommentDescription; 54 64 private var startupItemId:String = null; 55 65 … … 65 75 } 66 76 67 private function toggleUserSpace(event:Event):void {77 private function toggleUserSpace(event:Event):void { 68 78 var userSpace:Boolean = Config.instance.userSpace; 69 79 componentsSrv = ComponentListService.getInstance(userSpace); 70 80 profilesSrv = ProfileListService.getInstance(userSpace); 71 81 refresh(); 72 } 73 74 private function creationComplete():void {82 } 83 84 private function creationComplete():void { 75 85 refresh(); 76 86 } … … 81 91 componentsSrv.addEventListener(BrowserService.ITEMS_LOADED, componentsLoaded); 82 92 profilesSrv.addEventListener(BrowserService.ITEMS_LOADED, profilesLoaded); 83 } 84 refresh(); 85 } 86 87 public function refresh():void { 93 //commentsSrv.addEventListener(BrowserService.ITEMS_LOADED, commentsLoaded); 94 } 95 refresh(); 96 } 97 98 public function refresh():void { 88 99 componentsSrv.load(); 89 100 profilesSrv.load(); 90 } 101 } 91 102 92 103 private function profilesLoaded(event:Event):void { … … 101 112 componentsSrv.removeEventListener(BrowserService.ITEMS_LOADED, componentsLoaded); 102 113 } 114 115 /* private function commentsLoaded(event:Event):void { 116 var item:CommentDescription = CommentListService.findDescription(startupItemId); 117 loadStartupComment(item); 118 commentsSrv.removeEventListener(BrowserService.ITEMS_LOADED, commentsLoaded); 119 } */ 103 120 104 121 private function loadStartupItem(item:ItemDescription):void { … … 112 129 startupItemLoaded = true; 113 130 } 131 132 /* private function loadStartupComment(item:CommentDescription):void { 133 if (item) { 134 setSelectedCommentDescription(item); 135 startupItemId = null; 136 dispatchEvent(new Event(START_ITEM_LOADED)); 137 } else if (startupItemLoaded) { 138 dispatchEvent(new Event(START_ITEM_LOADED)); 139 } 140 startupItemLoaded = true; 141 } */ 114 142 115 143 private function loadProfileInfoPage(event:BrowserSelectionEvent):void { … … 132 160 } 133 161 } 162 163 /* public function setSelectedCommentDescription(desc:CommentDescription):void { 164 tabnav.selectedIndex = 0; 165 this.selectedCommentItem = desc; 166 commentSrv.load(desc); 167 } */ 134 168 135 169 public function getSelectedStartItem():ItemDescription { … … 170 204 <browser:BrowserOverviewList id="profilesOverview" 171 205 browserColumns="{browserColumns.getProfileColumns()}" 172 browserDataProvider="{profilesSrv.itemDescriptions}" 206 browserDataProvider="{profilesSrv.itemDescriptions}" 173 207 browserItemSelected="{loadProfileInfoPage(event)}" 174 208 itemToScrollTo="{selectedProfileItem}" … … 198 232 height="50%" 199 233 contextMenu="{componentsMenu.cm}"/> 200 201 234 </mx:VDividedBox> 202 235 </mx:TabNavigator> 236 203 237 </mx:VBox> 204 238 </mx:Canvas> -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/BrowserColumns.as
r1228 r1631 31 31 } 32 32 33 33 34 private function createColumn(dataField:String, headerText:String):DataGridColumn { 34 35 var c:DataGridColumn = new DataGridColumn(); … … 61 62 return sort 62 63 } 64 65 public static function getInitialSortForComments():Sort { 66 var sort:Sort = new Sort(); 67 var sortByGroup:SortField = new SortField("creatorName", true); 68 var sortByName:SortField = new SortField("id", true); 69 var sortByDate:SortField = new SortField("registrationDate", true, true); 70 sortByDate.compareFunction = compareRegistrationDate; 71 sort.fields = [sortByGroup, sortByName, sortByDate]; 72 return sort 73 } 63 74 64 75 private function createDateColumn():DataGridColumn { -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/BrowserSelectionEvent.as
r117 r1631 1 1 package clarin.cmdi.componentregistry.browser { 2 import clarin.cmdi.componentregistry.common.CommentDescription; 2 3 import clarin.cmdi.componentregistry.common.ItemDescription; 3 4 4 5 import flash.events.Event; 5 6 … … 8 9 public static const BROWSER_ITEM_SELECTED:String = "browserItemSelected"; 9 10 private var _itemDescription:ItemDescription; 10 11 private var _commentDescription:CommentDescription; 11 12 public function BrowserSelectionEvent(itemDescription:ItemDescription, bubbles:Boolean = false, cancelable:Boolean = false) { 12 13 super(BROWSER_ITEM_SELECTED, bubbles, cancelable); … … 16 17 public function get itemDescription():ItemDescription { 17 18 return _itemDescription; 19 } 20 21 public function get commentDescription():CommentDescription { 22 return _commentDescription; 18 23 } 19 24 -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/ComponentInfoPage.mxml
r249 r1631 6 6 backgroundColor="#DDE3EF" 7 7 > 8 8 9 9 <common:Component id="component"/> 10 11 10 <browser:infoPage id="infoPanel" 12 11 cmdComponent="{component.componentMD.xml}" -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/infoPage.mxml
r249 r1631 4 4 xmlns:common="clarin.cmdi.componentregistry.common.*" 5 5 xmlns:browser="clarin.cmdi.componentregistry.browser.*"> 6 7 <mx:Metadata> 8 [Event(name="startItemLoaded",type="flash.events.Event")] 9 </mx:Metadata> 10 <mx:Array id="browserColumns"/> 11 12 <mx:Script> 13 import clarin.cmdi.componentregistry.services.CommentInfoService; 14 import clarin.cmdi.componentregistry.services.CommentListService; 15 import clarin.cmdi.componentregistry.services.Config; 16 import clarin.cmdi.componentregistry.common.components.BrowseContextMenu; 17 import clarin.cmdi.componentregistry.common.components.RegistryViewStack; 18 import clarin.cmdi.componentregistry.services.DeleteService; 19 import clarin.cmdi.componentregistry.services.BrowserService; 20 21 [Bindable] 22 private var commentsMenu:BrowseContextMenu; 23 [Bindable] 24 private var selectedCommentItem:CommentDescription; 25 [Bindable] 26 private var commentsSrv:CommentListService = CommentListService.getInstance(Config.instance.userSpace); 27 [Bindable] 28 private var commentSrv:CommentInfoService = new CommentInfoService(); 29 30 public static const START_ITEM_LOADED:String = "startItemLoaded"; 31 private var startupItemLoaded:Boolean = false; 32 private var deleteSrv:DeleteService = DeleteService.instance; 33 private var _itemToScrollToComment:CommentDescription; 34 private var startupItemId:String = null; 35 36 public function init():void { 37 commentsMenu = new BrowseContextMenu(true); 38 commentsMenu.viewStack = this.parent as RegistryViewStack; 39 commentsMenu.deleteService = deleteSrv; 40 deleteSrv.addEventListener(DeleteService.ITEM_DELETED, handleItemDeleted); 41 } 42 43 public function loadStartup():void { 44 startupItemId = Config.instance.startupItem; 45 if (startupItemId) { //only load this once on startup 46 commentsSrv.addEventListener(BrowserService.ITEMS_LOADED, commentsLoaded); 47 } 48 49 private function commentsLoaded(event:Event):void { 50 var item:CommentDescription = CommentListService.findDescription(startupItemId); 51 loadStartupComment(item); 52 commentsSrv.removeEventListener(BrowserService.ITEMS_LOADED, commentsLoaded); 53 } 54 55 private function loadStartupComment(item:CommentDescription):void { 56 if (item) { 57 setSelectedCommentDescription(item); 58 startupItemId = null; 59 dispatchEvent(new Event(START_ITEM_LOADED)); 60 } else if (startupItemLoaded) { 61 dispatchEvent(new Event(START_ITEM_LOADED)); 62 } 63 startupItemLoaded = true; 64 } 65 66 public function setSelectedCommentDescription(desc:CommentDescription):void { 67 tabnav.selectedIndex = 0; 68 this.selectedCommentItem = desc; 69 commentSrv.load(desc); 70 } 71 72 public function refresh():void { 73 commentsSrv.load(); 74 } 6 75 76 77 private function handleItemDeleted(event:Event):void { 78 refresh(); 79 } 80 81 private function loadCommentInfoPage(event:BrowserSelectionEvent):void { 82 commentSrv.load(event.commentDescription); 83 84 85 } 86 87 </mx:Script> 88 7 89 <mx:XML id="cmdComponent"/> 90 <mx:XML id="cmdComment"/> 91 <mx:XML id="nrOfComments"/> 8 92 <common:ItemDescription id="itemDescription"/> 93 <common:CommentDescription id="commentDescription"/> 94 9 95 <mx:String id="headerLabel"/> 10 96 11 97 <mx:HBox horizontalAlign="center" 12 98 verticalAlign="middle" … … 19 105 dataProvider="{infoViewStack}"/> 20 106 </mx:HBox> 21 107 108 22 109 <mx:ViewStack id="infoViewStack" 23 110 height="100%" 24 111 width="100%" 25 112 styleName="borderStyles"> 26 113 27 114 <browser:xmlBrowsePanel id="viewPanel" 28 115 label="view" … … 32 119 label="xml" 33 120 cmdComponent="{cmdComponent}"/> 34 121 122 <mx:VDividedBox label="Comments({nrOfComments})" 123 width="100%"> 124 <browser:xmlCommentPanel 125 id="viewAllComments" width="399" height="109" 126 browseMenu="{commentsMenu}" 127 browserColumns="{browserColumns.getCommentColumns()}" 128 browserCommentSelected="{loadCommentInfoPage(event)}" 129 browserDataProvider="{commentsSrv.itemDescriptions}" 130 itemToScrollToComment="{selectedCommentItem}" 131 cmdComment="{cmdComment}" 132 commentDescription="{commentDescription}" 133 /> 134 <!-- id="viewComments" width="100%" --> 135 </mx:VDividedBox> 35 136 </mx:ViewStack> 36 137 37 138 </mx:VBox> -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/xmlPanel.mxml
r117 r1631 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" 3 xmlns:comp="clarin.cmdi.componentregistry.common.components.*" >3 xmlns:comp="clarin.cmdi.componentregistry.common.components.*" xmlns:common="clarin.cmdi.componentregistry.common.*"> 4 4 5 5 <mx:XML id="cmdComponent"/> -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/ItemDescription.as
r429 r1631 70 70 create(itemDescription, Config.instance.componentInfoUrl, false, isInUserSpace); 71 71 } 72 73 72 } 74 73 } -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDModelFactory.as
r1578 r1631 1 1 package clarin.cmdi.componentregistry.editor.model { 2 2 import clarin.cmdi.componentregistry.common.ComponentMD; 3 import clarin.cmdi.componentregistry.common.CommentMD; 3 4 import clarin.cmdi.componentregistry.common.ItemDescription; 5 import clarin.cmdi.componentregistry.common.CommentDescription; 4 6 import clarin.cmdi.componentregistry.editor.ValueSchemeItem; 5 7 6 8 import mx.collections.ArrayCollection; 7 9 import mx.collections.XMLListCollection; … … 22 24 var cmdComp:CMDComponent = createComponent(component); 23 25 result.cmdComponents.addItem(cmdComp); 26 } 27 return result; 28 } 29 30 public static function createCommentModel(xml:XML, description:CommentDescription):CMDSpec { 31 var result:CMDSpec = new CMDSpec(xml.@isProfile == "true"); 32 result.headerName = xml.Header.Name; 33 result.headerId = xml.Header.ID; 34 result.headerDescription = xml.Header.Description; 35 var comments:XMLList = xml.elements(CommentMD.CMD_COMMENT); 36 for each (var comment:XML in comments) { 37 var cmdComp:CMDComment = createComment(comment); 38 result.cmdComponents.addItem(cmdComp); 39 } 40 return result; 41 } 42 43 private static function createComment(xml:XML):CMDComment { 44 var result:CMDComment = new CMDComment(); 45 result.componentId = xml.@ComponentId; 46 result.profileId = xml.@ProfileId; 47 result.creatorName = xml.@creatorName; 48 result.filename = xml.@filename; 49 result.registerDate= xml.@registerDate; 50 result.commentId= xml.@commentId; 51 var comments:XMLList = xml.comments(); 52 for each (var comment:XML in comments) { 53 var cmdComment:CMDComment = createComment(comment); 54 result.cmdComments.addItem(cmdComment); 24 55 } 25 56 return result; -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BrowserService.as
r1375 r1631 1 1 package clarin.cmdi.componentregistry.services { 2 2 import clarin.cmdi.componentregistry.common.ItemDescription; 3 import clarin.cmdi.componentregistry.common.CommentDescription; 3 4 4 5 import com.adobe.net.URI; … … 92 93 return null; 93 94 } 95 96 public function lookUpComDescription(componentId:String):CommentDescription { 97 for each (var item:CommentDescription in unFilteredItemDescriptions) { 98 if (item.id == componentId) { 99 return item; 100 } 101 } 102 return null; 103 } 94 104 } 95 105 } -
ComponentRegistry/branches/jeaferversion/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/Config.as
r1473 r1631 28 28 private static const COMPONENT_LIST_URL:String = "/rest/registry/components"; 29 29 private static const PROFILE_LIST_URL:String = "/rest/registry/profiles"; 30 private static const COMMENT_LIST_URL:String = "/rest/registry/comments"; 31 /* private static const COMMENTPROFILE_LIST_URL:String = "/rest/registry/profiles/comments"; 32 private static const COMMENTCOMPONENT_LIST_URL:String = "/rest/registry/components/comments";*/ 30 33 private static const COMPONENT_USAGE_URL:String = "/rest/registry/components/usage/"; 31 34 private static const UPLOAD_PROFILE_SERVICE_URL:String = "/rest/registry/profiles"; 32 35 private static const UPLOAD_COMPONENT_SERVICE_URL:String = "/rest/registry/components"; 36 /* private static const UPLOAD_COMMENTC_SERVICE_URL:String = "/rest/registry/components/comments"; 37 private static const UPLOAD_COMMENTP_SERVICE_URL:String = "/rest/registry/profiles/comments";*/ 33 38 private static const PROFILE_INFO_URL:String = "/rest/registry/profiles/"; 34 39 private static const COMPONENT_INFO_URL:String = "/rest/registry/components/"; 40 private static const COMMENTPROFILE_INFO_URL:String = "/rest/registry/profiles/comments"; 41 private static const COMMENTCOMPONENT_INFO_URL:String = "/rest/registry/components/comments"; 35 42 private static const PING_SESSION_URL:String = "/rest/registry/pingSession"; 36 43 private static const ISOCAT_SERVLET:String = "/isocat"; … … 90 97 } 91 98 99 public function get commentListUrl():String { 100 return _serviceRootUrl + COMMENT_LIST_URL; 101 } 102 103 /* public function get commentProfileListUrl():String { 104 return _serviceRootUrl + COMMENTPROFILE_LIST_URL; 105 } 106 107 public function get commentComponentListUrl():String { 108 return _serviceRootUrl + COMMENTCOMPONENT_LIST_URL; 109 }*/ 110 92 111 public function get componentUsageUrl():String { 93 112 return _serviceRootUrl + COMPONENT_USAGE_URL; … … 101 120 return _serviceRootUrl + COMPONENT_INFO_URL; 102 121 } 122 123 public function get commentProfileInfoUrl():String { 124 return _serviceRootUrl + COMMENTPROFILE_INFO_URL; 125 } 126 public function get commentComponentInfoUrl():String { 127 return _serviceRootUrl + COMMENTCOMPONENT_INFO_URL; 128 } 103 129 104 130 public function get uploadProfileUrl():String { … … 109 135 return _serviceRootUrl + UPLOAD_COMPONENT_SERVICE_URL; 110 136 } 137 138 /* public function get uploadCommentPURL():String { 139 return _serviceRootUrl + UPLOAD_COMMENTP_SERVICE_URL; 140 } 141 142 public function get uploadCommentCURL():String { 143 return _serviceRootUrl + UPLOAD_COMMENTC_SERVICE_URL; 144 }*/ 111 145 112 146 public function get isocatSearchUrl():String { -
ComponentRegistry/branches/jeaferversion/ComponentRegistry
- Property svn:ignore
-
old new 7 7 profiles.xml 8 8 nb-configuration.xml 9 nbactions-Run without tests.xml
-
- Property svn:ignore
-
ComponentRegistry/branches/jeaferversion/ComponentRegistry/pom.xml
r1592 r1631 197 197 <ComponentRegistrySwfName>${pom.artifactId}-${ComponentBrowserGui.version}</ComponentRegistrySwfName> 198 198 <flexDebug>0</flexDebug> 199 <netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server> 199 200 </properties> 200 201 -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/CMDComponentSpecExpander.java
r1562 r1631 103 103 return result; 104 104 } 105 106 // protected CMDComponentSpec expandComment(String commentId) throws ComponentRegistryException { 107 // CMDComponentSpec result = getUncachedComment(commentId); 108 // List<CMDComponentType> cmdComponents = result.getCMDComponent(); 109 // expandNestedComponent(cmdComponents); 110 // return result; 111 // } 105 112 106 113 /** … … 111 118 112 119 protected abstract CMDComponentSpec getUncachedProfile(String profileId) throws ComponentRegistryException; 120 121 // protected abstract CMDComponentSpec getUncachedComment(String commentId) throws ComponentRegistryException; 113 122 } -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/ComponentRegistry.java
r1604 r1631 8 8 import clarin.cmdi.componentregistry.components.CMDComponentSpec; 9 9 import clarin.cmdi.componentregistry.model.AbstractDescription; 10 import clarin.cmdi.componentregistry.model.CommentMapping.Comment; 10 11 import clarin.cmdi.componentregistry.model.ComponentDescription; 11 12 import clarin.cmdi.componentregistry.model.ProfileDescription; … … 32 33 List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException; 33 34 35 36 //List<Comment> getComments() throws ComponentRegistryException; 37 34 38 /** 35 39 * … … 44 48 45 49 CMDComponentSpec getMDComponent(String id) throws ComponentRegistryException; 50 //CMDComponentSpec getMDComment(String id) throws ComponentRegistryException; 46 51 47 52 /** … … 98 103 DeleteFailedException; 99 104 105 106 //void deleteMDComment(String commentId, Principal principal)throws IOException, UserUnauthorizedException, ComponentRegistryException, DeleteFailedException; 100 107 /** 101 108 * … … 136 143 */ 137 144 List<ComponentDescription> getDeletedComponentDescriptions(); 145 146 147 List<Comment> getCommentsInProfile(String profileId) throws ComponentRegistryException; 148 149 150 151 Comment getSpecifiedCommentInProfile(String commentId) throws ComponentRegistryException; 152 153 List<Comment> getCommentsInComponent(String componentId) throws ComponentRegistryException; 154 Comment getSpecifiedCommentInComponent(String commentId) throws ComponentRegistryException; 155 156 138 157 139 158 -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/ComponentRegistryImplBase.java
r1604 r1631 20 20 import clarin.cmdi.componentregistry.components.CMDComponentSpec.Header; 21 21 import clarin.cmdi.componentregistry.model.AbstractDescription; 22 import clarin.cmdi.componentregistry.model.CommentMapping.Comment; 22 23 import clarin.cmdi.componentregistry.model.ComponentDescription; 23 24 import clarin.cmdi.componentregistry.model.ProfileDescription; … … 33 34 @Override 34 35 public List<ComponentDescription> getUsageInComponents(String componentId) throws ComponentRegistryException { 35 36 37 38 39 40 41 42 43 36 List<ComponentDescription> result = new ArrayList<ComponentDescription>(); 37 List<ComponentDescription> descs = getComponentDescriptions(); 38 for (ComponentDescription desc : descs) { 39 CMDComponentSpec spec = getMDComponent(desc.getId()); 40 if (spec != null && findComponentId(componentId, spec.getCMDComponent())) { 41 result.add(desc); 42 } 43 } 44 return result; 44 45 } 45 46 46 47 @Override 47 48 public List<ProfileDescription> getUsageInProfiles(String componentId) throws ComponentRegistryException { 48 49 50 51 52 53 54 55 49 List<ProfileDescription> result = new ArrayList<ProfileDescription>(); 50 for (ProfileDescription profileDescription : getProfileDescriptions()) { 51 CMDComponentSpec profile = getMDProfile(profileDescription.getId()); 52 if (profile != null && findComponentId(componentId, profile.getCMDComponent())) { 53 result.add(profileDescription); 54 } 55 } 56 return result; 56 57 } 58 59 // public List<Comment> getUsageInComments(String componentId) throws ComponentRegistryException { 60 // List<Comment> result = new ArrayList<Comment>(); 61 // for (Comment comment : getComments()) { 62 // CMDComponentSpec myComment = getMDComment(comment.getId()); 63 // if (myComment != null && findComponentId(componentId, myComment.getCMDComponent())) { 64 // result.add(comment); 65 // System.out.println("get unsage in comments : " + myComment + "\n"); 66 // } 67 // } 68 // 69 // return result; 70 // } 57 71 58 72 /** … … 63 77 @Override 64 78 public List<ProfileDescription> getProfileDescriptionsForMetadaEditor() throws ComponentRegistryException { 65 79 // TODO: Below can also be done by accepting and passing a parameter in the ProfileDescriptionDao, should have better performance 66 80 67 68 69 70 71 72 73 74 75 76 77 81 // Get all profile descriptions 82 List<ProfileDescription> descriptionsCollection = getProfileDescriptions(); 83 // Filter out ones that do should not be shown for metadata editor 84 ArrayList<ProfileDescription> descriptions = new ArrayList<ProfileDescription>(descriptionsCollection.size()); 85 for (ProfileDescription profile : descriptionsCollection) { 86 if (((ProfileDescription) profile).isShowInEditor()) { 87 descriptions.add((ProfileDescription) profile); 88 } 89 } 90 // Return filtered list 91 return descriptions; 78 92 } 79 93 80 94 /* HELPER METHODS */ 81 95 protected static String stripRegistryId(String id) { 82 96 return StringUtils.removeStart(id, ComponentRegistry.REGISTRY_ID); 83 97 } 84 98 85 99 protected static void enrichSpecHeader(CMDComponentSpec spec, AbstractDescription description) { 86 87 88 89 90 91 92 93 100 Header header = spec.getHeader(); 101 header.setID(description.getId()); 102 if (StringUtils.isEmpty(header.getName())) { 103 header.setName(description.getName()); 104 } 105 if (StringUtils.isEmpty(header.getDescription())) { 106 header.setDescription(description.getDescription()); 107 } 94 108 } 95 109 96 110 protected static boolean findComponentId(String componentId, List<CMDComponentType> componentReferences) { 97 98 99 100 101 102 103 104 111 for (CMDComponentType cmdComponent : componentReferences) { 112 if (componentId.equals(cmdComponent.getComponentId())) { 113 return true; 114 } else if (findComponentId(componentId, cmdComponent.getCMDComponent())) { 115 return true; 116 } 117 } 118 return false; 105 119 } 106 120 107 121 protected static void writeXsd(CMDComponentSpec expandedSpec, OutputStream outputStream) { 108 122 MDMarshaller.generateXsd(expandedSpec, outputStream); 109 123 } 110 124 111 125 protected static void writeXml(CMDComponentSpec spec, OutputStream outputStream) { 112 113 114 115 116 117 118 126 try { 127 MDMarshaller.marshal(spec, outputStream); 128 } catch (UnsupportedEncodingException e) { 129 LOG.error("Error in encoding: ", e); 130 } catch (JAXBException e) { 131 LOG.error("Cannot marshall spec: " + spec, e); 132 } 119 133 } 120 134 121 135 protected void checkStillUsed(String componentId) throws DeleteFailedException, ComponentRegistryException { 122 123 124 125 126 136 List<ProfileDescription> profiles = getUsageInProfiles(componentId); 137 List<ComponentDescription> components = getUsageInComponents(componentId); 138 if (!profiles.isEmpty() || !components.isEmpty()) { 139 throw new DeleteFailedException(createStillInUseMessage(profiles, components)); 140 } 127 141 } 128 142 129 143 private String createStillInUseMessage(List<ProfileDescription> profiles, List<ComponentDescription> components) { 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 144 StringBuilder result = new StringBuilder(); 145 if (!profiles.isEmpty()) { 146 result.append("Still used by the following profiles: \n"); 147 for (ProfileDescription profileDescription : profiles) { 148 result.append(" - ").append(profileDescription.getName()).append("\n"); 149 } 150 } 151 if (!components.isEmpty()) { 152 result.append("Still used by the following components: \n"); 153 for (ComponentDescription componentDescription : components) { 154 result.append(" - ").append(componentDescription.getName()).append("\n"); 155 } 156 } 157 result.append("Try to change above mentioned references first."); 158 return result.toString(); 145 159 } 146 160 } -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/CMDComponentSpecExpanderDbImpl.java
r1359 r1631 14 14 15 15 public CMDComponentSpecExpanderDbImpl(ComponentRegistryDbImpl registry) { 16 17 16 super(registry); 17 dbImplRegistry = registry; 18 18 } 19 19 20 20 public static CMDComponentSpec expandComponent(String componentId, ComponentRegistryDbImpl registry) throws ComponentRegistryException { 21 22 21 CMDComponentSpecExpanderDbImpl expander = new CMDComponentSpecExpanderDbImpl(registry); 22 return expander.expandComponent(componentId); 23 23 } 24 24 25 25 public static CMDComponentSpec expandProfile(String profileId, ComponentRegistryDbImpl registry) throws ComponentRegistryException { 26 27 26 CMDComponentSpecExpanderDbImpl expander = new CMDComponentSpecExpanderDbImpl(registry); 27 return expander.expandProfile(profileId); 28 28 } 29 29 30 30 @Override 31 31 protected CMDComponentSpec getUncachedComponent(String componentId) throws ComponentRegistryException { 32 32 return dbImplRegistry.getUncachedMDComponent(componentId); 33 33 } 34 34 35 35 @Override 36 36 protected CMDComponentSpec getUncachedProfile(String profileId) throws ComponentRegistryException { 37 37 return dbImplRegistry.getUncachedMDProfile(profileId); 38 38 } 39 39 } -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDao.java
r1319 r1631 12 12 public abstract class ComponentRegistryDao<T> extends SimpleJdbcDaoSupport { 13 13 14 public final static String DATABASE_NAME = "component_registry"; 14 15 public final static String TABLE_COMMENTS = "comments"; 15 16 public final static String TABLE_COMPONENT_DESCRIPTION = "component_description"; 16 17 public final static String TABLE_PROFILE_DESCRIPTION = "profile_description"; … … 18 19 public final static String TABLE_REGISTRY_USER = "registry_user"; 19 20 public final static String COLUMN_ID = "id"; 21 20 22 21 23 public ComponentRegistryDao() { -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java
r1604 r1631 29 29 import clarin.cmdi.componentregistry.impl.ComponentRegistryImplBase; 30 30 import clarin.cmdi.componentregistry.model.AbstractDescription; 31 import clarin.cmdi.componentregistry.model.CommentMapping.Comment; 31 32 import clarin.cmdi.componentregistry.model.ComponentDescription; 32 33 import clarin.cmdi.componentregistry.model.ProfileDescription; … … 49 50 @Autowired 50 51 private ComponentDescriptionDao componentDescriptionDao; 51 @Autowired 52 @Autowired 52 53 private UserDao userDao; 53 54 @Autowired … … 57 58 @Qualifier("profilesCache") 58 59 private CMDComponentSpecCache profilesCache; 60 @Autowired 61 private CommentsDao commentsDao; 62 //private CMDComponentSpecCache commentsCache; 59 63 60 64 /** … … 76 80 */ 77 81 public ComponentRegistryDbImpl(Number userId) { 78 82 this.userId = userId; 79 83 } 80 84 81 85 @Override 82 86 public List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException { 83 84 85 86 87 88 89 90 91 92 } 93 87 try { 88 if (isPublic()) { 89 return profileDescriptionDao.getPublicProfileDescriptions(); 90 } else { 91 return profileDescriptionDao.getUserspaceDescriptions(getUserId()); 92 } 93 } catch (DataAccessException ex) { 94 throw new ComponentRegistryException("Database access error while trying to get profile descriptions", ex); 95 } 96 } 97 94 98 @Override 95 99 public ProfileDescription getProfileDescription(String id) throws ComponentRegistryException { 96 97 98 99 100 100 try { 101 return profileDescriptionDao.getByCmdId(id, getUserId()); 102 } catch (DataAccessException ex) { 103 throw new ComponentRegistryException("Database access error while trying to get profile description", ex); 104 } 101 105 } 102 106 103 107 @Override 104 108 public List<ComponentDescription> getComponentDescriptions() throws ComponentRegistryException { 105 106 107 108 109 110 111 112 113 109 try { 110 if (isPublic()) { 111 return componentDescriptionDao.getPublicComponentDescriptions(); 112 } else { 113 return componentDescriptionDao.getUserspaceDescriptions(getUserId()); 114 } 115 } catch (DataAccessException ex) { 116 throw new ComponentRegistryException("Database access error while trying to get component descriptions", ex); 117 } 114 118 } 115 119 116 120 @Override 117 121 public ComponentDescription getComponentDescription(String id) throws ComponentRegistryException { 118 try { 119 return componentDescriptionDao.getByCmdId(id, getUserId()); 120 } catch (DataAccessException ex) { 121 throw new ComponentRegistryException("Database access error while trying to get component description", ex); 122 } 123 } 122 try { 123 return componentDescriptionDao.getByCmdId(id, getUserId()); 124 } catch (DataAccessException ex) { 125 throw new ComponentRegistryException("Database access error while trying to get component description", ex); 126 } 127 } 128 129 @Override 130 public List<Comment> getCommentsInProfile(String profileId) throws ComponentRegistryException { 131 try { 132 return commentsDao.getCommentsFromProfile(profileId); 133 } catch (DataAccessException ex) { 134 throw new ComponentRegistryException("Database access error while trying to get comment from profile", ex); 135 } 136 } 137 138 @Override 139 public Comment getSpecifiedCommentInProfile(String commentId) throws ComponentRegistryException { 140 try { 141 return commentsDao.getSpecifiedCommentFromProfile(commentId); 142 } catch (DataAccessException ex) { 143 throw new ComponentRegistryException("Database access error while trying to get comment from component", ex); 144 } 145 } 146 147 @Override 148 public List<Comment> getCommentsInComponent(String componentId) throws ComponentRegistryException { 149 try { 150 return commentsDao.getCommentsFromComponent(componentId); 151 } catch (DataAccessException ex) { 152 throw new ComponentRegistryException("Database access error while trying to get comment from component", ex); 153 } 154 } 155 156 @Override 157 public Comment getSpecifiedCommentInComponent(String commentId) throws ComponentRegistryException { 158 try { 159 return commentsDao.getSpecifiedCommentFromComponent(commentId); 160 } catch (DataAccessException ex) { 161 throw new ComponentRegistryException("Database access error while trying to get comment from component", ex); 162 } 163 } 164 165 // @Override 166 // public List<Comment> getComments() throws ComponentRegistryException { 167 // throw new UnsupportedOperationException("Not supported yet."); 168 // } 124 169 125 170 @Override 126 171 public CMDComponentSpec getMDProfile(String id) throws ComponentRegistryException { 127 128 129 130 131 132 133 134 135 136 137 172 if (inWorkspace(profileDescriptionDao, id)) { 173 CMDComponentSpec result = profilesCache.get(id); 174 if (result == null && !profilesCache.containsKey(id)) { 175 result = getUncachedMDProfile(id); 176 profilesCache.put(id, result); 177 } 178 return result; 179 } else { 180 // May exist, but not in this workspace 181 return null; 182 } 138 183 } 139 184 140 185 public CMDComponentSpec getUncachedMDProfile(String id) throws ComponentRegistryException { 141 142 143 144 145 186 try { 187 return getUncachedMDComponent(id, profileDescriptionDao); 188 } catch (DataAccessException ex) { 189 throw new ComponentRegistryException("Database access error while trying to get profile", ex); 190 } 146 191 } 147 192 148 193 @Override 149 194 public CMDComponentSpec getMDComponent(String id) throws ComponentRegistryException { 150 151 152 153 154 155 156 157 158 159 195 if (inWorkspace(componentDescriptionDao, id)) { 196 CMDComponentSpec result = componentsCache.get(id); 197 if (result == null && !componentsCache.containsKey(id)) { 198 result = getUncachedMDComponent(id); 199 componentsCache.put(id, result); 200 } 201 return result; 202 } else { 203 return null; 204 } 160 205 } 161 206 162 207 public CMDComponentSpec getUncachedMDComponent(String id) throws ComponentRegistryException { 163 try { 164 return getUncachedMDComponent(id, componentDescriptionDao); 165 } catch (DataAccessException ex) { 166 throw new ComponentRegistryException("Database access error while trying to get component", ex); 167 } 168 } 208 try { 209 return getUncachedMDComponent(id, componentDescriptionDao); 210 } catch (DataAccessException ex) { 211 throw new ComponentRegistryException("Database access error while trying to get component", ex); 212 } 213 } 214 215 //// @Override 216 //// public CMDComponentSpec getMDComment(String id) throws ComponentRegistryException { 217 ////// if (inWorkspace(commentsDao, id)) { 218 ////// CMDComponentSpec result = commentsCache.get(id); 219 ////// if (result == null && !commentsCache.containsKey(id)) { 220 ////// result = getUncachedMDComment(id); 221 ////// commentsCache.put(id, result); 222 ////// } 223 ////// return result; 224 ////// } else { 225 ////// // May exist, but not in this workspace 226 //// return null; 227 ////// } 228 //// } 229 // 230 //// public CMDComponentSpec getUncachedMDComment(String id) throws ComponentRegistryException { 231 //// try { 232 //// return getUncachedMDComment(id, commentsDao); 233 //// } catch (DataAccessException ex) { 234 //// throw new ComponentRegistryException("Database access error while trying to get component", ex); 235 // } 236 // } 169 237 170 238 @Override 171 239 public int register(AbstractDescription description, CMDComponentSpec spec) { 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 240 enrichSpecHeader(spec, description); 241 try { 242 String xml = componentSpecToString(spec); 243 // Convert principal name to user record id 244 Number uid = convertUserIdInDescription(description); 245 getDaoForDescription(description).insertDescription(description, xml, isPublic(), uid); 246 invalidateCache(description); 247 return 0; 248 } catch (DataAccessException ex) { 249 LOG.error("Database error while registering component", ex); 250 return -1; 251 } catch (JAXBException ex) { 252 LOG.error("Error while registering component", ex); 253 return -2; 254 } catch (UnsupportedEncodingException ex) { 255 LOG.error("Error while registering component", ex); 256 return -3; 257 } 190 258 } 191 259 … … 201 269 */ 202 270 private Number convertUserIdInDescription(AbstractDescription description) throws DataAccessException { 203 204 205 206 207 208 209 210 211 212 213 214 215 271 Number uid = null; 272 if (description.getUserId() != null) { 273 User user = userDao.getByPrincipalName(description.getUserId()); 274 if (user != null) { 275 uid = user.getId(); 276 } 277 } else { 278 uid = userId; 279 } 280 if (uid != null) { 281 description.setUserId(uid.toString()); 282 } 283 return uid; 216 284 } 217 285 218 286 @Override 219 287 public int update(AbstractDescription description, CMDComponentSpec spec, Principal principal, boolean forceUpdate) { 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 288 try { 289 checkAuthorisation(description, principal); 290 checkAge(description, principal); 291 // For public components, check if used in other components or profiles (unless forced) 292 if (!forceUpdate && this.isPublic() && !description.isProfile()) { 293 checkStillUsed(description.getId()); 294 } 295 AbstractDescriptionDao<?> dao = getDaoForDescription(description); 296 dao.updateDescription(getIdForDescription(description), description, componentSpecToString(spec)); 297 invalidateCache(description); 298 return 0; 299 } catch (JAXBException ex) { 300 LOG.error("Error while updating component", ex); 301 return -1; 302 } catch (UnsupportedEncodingException ex) { 303 LOG.error("Error while updating component", ex); 304 return -1; 305 } catch (IllegalArgumentException ex) { 306 LOG.error("Error while updating component", ex); 307 return -1; 308 } catch (UserUnauthorizedException e) { 309 LOG.error("Error while updating component", e); 310 return -1; 311 } catch (DeleteFailedException e) { 312 LOG.error("Error while updating component", e); 313 return -1; 314 } catch (ComponentRegistryException e) { 315 LOG.error("Error while updating component", e); 316 return -1; 317 } 250 318 } 251 319 252 320 @Override 253 321 public int publish(AbstractDescription desc, CMDComponentSpec spec, Principal principal) { 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 322 int result = 0; 323 AbstractDescriptionDao<?> dao = getDaoForDescription(desc); 324 if (!isPublic()) { // if already in public workspace there is nothing todo 325 desc.setHref(AbstractDescription.createPublicHref(desc.getHref())); 326 Number id = getIdForDescription(desc); 327 try { 328 // Update description & content 329 dao.updateDescription(id, desc, componentSpecToString(spec)); 330 // Set to public 331 dao.setPublished(id, true); 332 } catch (DataAccessException ex) { 333 LOG.error("Database error while updating component", ex); 334 return -1; 335 } catch (JAXBException ex) { 336 LOG.error("Error while updating component", ex); 337 return -2; 338 } catch (UnsupportedEncodingException ex) { 339 LOG.error("Error while updating component", ex); 340 return -3; 341 } 342 } 343 return result; 276 344 } 277 345 278 346 @Override 279 347 public void getMDProfileAsXml(String profileId, OutputStream output) throws ComponentRegistryException { 280 281 348 CMDComponentSpec expandedSpec = CMDComponentSpecExpanderDbImpl.expandProfile(profileId, this); 349 writeXml(expandedSpec, output); 282 350 } 283 351 284 352 @Override 285 353 public void getMDProfileAsXsd(String profileId, OutputStream outputStream) throws ComponentRegistryException { 286 287 354 CMDComponentSpec expandedSpec = CMDComponentSpecExpanderDbImpl.expandProfile(profileId, this); 355 writeXsd(expandedSpec, outputStream); 288 356 } 289 357 290 358 @Override 291 359 public void getMDComponentAsXml(String componentId, OutputStream output) throws ComponentRegistryException { 292 293 360 CMDComponentSpec expandedSpec = CMDComponentSpecExpanderDbImpl.expandComponent(componentId, this); 361 writeXml(expandedSpec, output); 294 362 } 295 363 296 364 @Override 297 365 public void getMDComponentAsXsd(String componentId, OutputStream outputStream) throws ComponentRegistryException { 298 299 366 CMDComponentSpec expandedSpec = CMDComponentSpecExpanderDbImpl.expandComponent(componentId, this); 367 writeXsd(expandedSpec, outputStream); 300 368 } 301 369 302 370 @Override 303 371 public void deleteMDProfile(String profileId, Principal principal) throws UserUnauthorizedException, DeleteFailedException, 304 ComponentRegistryException { 305 ProfileDescription desc = getProfileDescription(profileId); 306 if (desc != null) { 307 try { 308 checkAuthorisation(desc, principal); 309 checkAge(desc, principal); 310 profileDescriptionDao.setDeleted(desc, true); 311 invalidateCache(desc); 312 } catch (DataAccessException ex) { 313 throw new DeleteFailedException("Database access error while trying to delete profile", ex); 314 } 315 } 316 } 372 ComponentRegistryException { 373 ProfileDescription desc = getProfileDescription(profileId); 374 if (desc != null) { 375 try { 376 checkAuthorisation(desc, principal); 377 checkAge(desc, principal); 378 profileDescriptionDao.setDeleted(desc, true); 379 invalidateCache(desc); 380 } catch (DataAccessException ex) { 381 throw new DeleteFailedException("Database access error while trying to delete profile", ex); 382 } 383 } 384 } 385 386 // public void deleteMDComment(String commentId, Principal principal) throws UserUnauthorizedException, DeleteFailedException, ComponentRegistryException { 387 // Comment desc = getCommentsInComponent(commentId); 388 // if(desc != null) { 389 // try { 390 // checkAuthorisationComment(desc, principal); 391 // checkCommentAge(desc, principal); 392 // commentsDao.setDeleted(desc, true); 393 // invalidateCommentCache(desc); 394 // } catch (DataAccessException ex) { 395 // throw new DeleteFailedException("Database access error while trying to delete profile", ex); 396 // } 397 // } 398 // } 317 399 318 400 @Override 319 401 public void deleteMDComponent(String componentId, Principal principal, boolean forceDelete) throws UserUnauthorizedException, 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 402 DeleteFailedException, ComponentRegistryException { 403 ComponentDescription desc = componentDescriptionDao.getByCmdId(componentId); 404 if (desc != null) { 405 try { 406 checkAuthorisation(desc, principal); 407 checkAge(desc, principal); 408 409 if (!forceDelete) { 410 checkStillUsed(componentId); 411 } 412 componentDescriptionDao.setDeleted(desc, true); 413 invalidateCache(desc); 414 } catch (DataAccessException ex) { 415 throw new DeleteFailedException("Database access error while trying to delete component", ex); 416 } 417 } 336 418 } 337 419 338 420 @Override 339 421 public boolean isPublic() { 340 422 return null == userId; 341 423 } 342 424 343 425 public void setPublic() { 344 426 this.userId = null; 345 427 } 346 428 … … 349 431 */ 350 432 public Number getUserId() { 351 433 return userId; 352 434 } 353 435 … … 358 440 */ 359 441 public void setUserId(Number user) { 360 442 this.userId = user; 361 443 } 362 444 363 445 private void invalidateCache(AbstractDescription description) { 364 if (description.isProfile()) { 365 profilesCache.remove(description.getId()); 366 } else { 367 componentsCache.remove(description.getId()); 368 } 369 } 446 if (description.isProfile()) { 447 profilesCache.remove(description.getId()); 448 } else { 449 componentsCache.remove(description.getId()); 450 } 451 } 452 453 // private void invalidateCommentCache(Comment comment) { 454 // commentsCache.remove(comment.getId()); 455 // } 370 456 371 457 private AbstractDescriptionDao<?> getDaoForDescription(AbstractDescription description) { 372 return description.isProfile() ? profileDescriptionDao : componentDescriptionDao; 373 } 458 return description.isProfile() ? profileDescriptionDao : componentDescriptionDao; 459 } 460 461 // private CommentsDao getDaoForCommentDescription(Comment comment) { 462 // return commentsDao; 463 // } 374 464 375 465 /** … … 384 474 */ 385 475 private Number getIdForDescription(AbstractDescription description) throws IllegalArgumentException { 386 Number dbId = null; 387 AbstractDescriptionDao<?> dao = getDaoForDescription(description); 388 try { 389 dbId = dao.getDbId(description.getId()); 390 } catch (DataAccessException ex) { 391 LOG.error("Error getting dbId for component with id " + description.getId(), ex); 392 } 393 if (dbId == null) { 394 throw new IllegalArgumentException("Could not get database Id for description"); 395 } else { 396 return dbId; 397 } 398 } 399 476 Number dbId = null; 477 AbstractDescriptionDao<?> dao = getDaoForDescription(description); 478 try { 479 dbId = dao.getDbId(description.getId()); 480 } catch (DataAccessException ex) { 481 LOG.error("Error getting dbId for component with id " + description.getId(), ex); 482 } 483 if (dbId == null) { 484 throw new IllegalArgumentException("Could not get database Id for description"); 485 } else { 486 return dbId; 487 } 488 } 489 490 491 // private Number getIdForCommentDescription(Comment comment) throws IllegalArgumentException { 492 // Number dbId = null; 493 // CommentsDao dao = getDaoForCommentDescription(comment); 494 // try { 495 // dbId = dao.getDbId(comment.getId()); 496 // } catch (DataAccessException ex) { 497 // LOG.error("Error getting dbId for comment with id " + comment.getId(), ex); 498 // } 499 // if (dbId == null) { 500 // throw new IllegalArgumentException("Could not get database Id for description"); 501 // } else { 502 // return dbId; 503 // } 504 // } 505 400 506 private String componentSpecToString(CMDComponentSpec spec) throws UnsupportedEncodingException, JAXBException { 401 402 403 404 507 ByteArrayOutputStream os = new ByteArrayOutputStream(); 508 MDMarshaller.marshal(spec, os); 509 String xml = os.toString("UTF-8"); 510 return xml; 405 511 } 406 512 407 513 private CMDComponentSpec getUncachedMDComponent(String id, AbstractDescriptionDao dao) { 408 String xml = dao.getContent(false, id); 409 if (xml != null) { 410 try { 411 InputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8")); 412 return MDMarshaller.unmarshal(CMDComponentSpec.class, is, null); 413 414 } catch (JAXBException ex) { 415 LOG.error(null, ex); 416 } catch(UnsupportedEncodingException ex){ 417 LOG.error(null, ex); 418 } 419 } 420 return null; 421 } 514 String xml = dao.getContent(false, id); 515 if (xml != null) { 516 try { 517 InputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8")); 518 return MDMarshaller.unmarshal(CMDComponentSpec.class, is, null); 519 520 } catch (JAXBException ex) { 521 LOG.error(null, ex); 522 } catch (UnsupportedEncodingException ex) { 523 LOG.error(null, ex); 524 } 525 } 526 return null; 527 } 528 529 // private CMDComponentSpec getUncachedMDComment(String id, CommentsDao dao) { 530 // String xml = dao.getContent(false, id); 531 // if (xml != null) { 532 // try { 533 // InputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8")); 534 // return MDMarshaller.unmarshal(CMDComponentSpec.class, is, null); 535 // 536 // } catch (JAXBException ex) { 537 // LOG.error(null, ex); 538 // } catch (UnsupportedEncodingException ex) { 539 // LOG.error(null, ex); 540 // } 541 // } 542 // return null; 543 // } 422 544 423 545 private void checkAuthorisation(AbstractDescription desc, Principal principal) throws UserUnauthorizedException { 424 if (!isOwnerOfDescription(desc, principal.getName()) && !configuration.isAdminUser(principal)) { 425 throw new UserUnauthorizedException("Unauthorized operation user '" + principal.getName() 426 + "' is not the creator (nor an administrator) of the " + (desc.isProfile() ? "profile" : "component") + "(" + desc 427 + ")."); 428 } 429 } 546 if (!isOwnerOfDescription(desc, principal.getName()) && !configuration.isAdminUser(principal)) { 547 throw new UserUnauthorizedException("Unauthorized operation user '" + principal.getName() 548 + "' is not the creator (nor an administrator) of the " + (desc.isProfile() ? "profile" : "component") + "(" + desc 549 + ")."); 550 } 551 } 552 553 // private void checkAuthorisationComment(Comment desc, Principal principal)throws UserUnauthorizedException { 554 // if (!isOwnerOfComment(desc, principal.getName()) && !configuration.isAdminUser(principal)) { 555 // throw new UserUnauthorizedException("Unauthorized operation user '" + principal.getName() 556 // + "' is not the creator (nor an administrator) of the " + (desc.getId()) + "(" + desc 557 // + ")."); 558 // } 559 // } 430 560 431 561 private boolean isOwnerOfDescription(AbstractDescription desc, String principalName) { 432 String owner = getDaoForDescription(desc).getOwnerPrincipalName(getIdForDescription(desc)); 433 return owner != null // If owner is null, no one can be owner 434 && principalName.equals(owner); 435 } 562 String owner = getDaoForDescription(desc).getOwnerPrincipalName(getIdForDescription(desc)); 563 return owner != null // If owner is null, no one can be owner 564 && principalName.equals(owner); 565 } 566 567 // private boolean isOwnerOfComment(Comment desc, String principalName) { 568 // String owner = getDaoForCommentDescription(desc).getOwnerPrincipalName(getIdForCommentDescription(desc)); 569 // return owner != null // If owner is null, no one can be owner 570 // && principalName.equals(owner); 571 // } 436 572 437 573 private void checkAge(AbstractDescription desc, Principal principal) throws DeleteFailedException { 438 if (isPublic() && !configuration.isAdminUser(principal)) { 439 try { 440 Date regDate = AbstractDescription.getDate(desc.getRegistrationDate()); 441 Calendar calendar = Calendar.getInstance(); 442 calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); 443 if (regDate.before(calendar.getTime())) { // More then month old 444 throw new DeleteFailedException( 445 "The " 446 + (desc.isProfile() ? "Profile" : "Component") 447 + " is more then a month old and cannot be deleted anymore. It might have been used to create metadata, deleting it would invalidate that metadata."); 448 } 449 } catch (ParseException e) { 450 LOG.error("Cannot parse date of " + desc + " Error:" + e); 451 } 452 } 453 } 574 if (isPublic() && !configuration.isAdminUser(principal)) { 575 try { 576 Date regDate = AbstractDescription.getDate(desc.getRegistrationDate()); 577 Calendar calendar = Calendar.getInstance(); 578 calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); 579 if (regDate.before(calendar.getTime())) { // More then month old 580 throw new DeleteFailedException( 581 "The " 582 + (desc.isProfile() ? "Profile" : "Component") 583 + " is more then a month old and cannot be deleted anymore. It might have been used to create metadata, deleting it would invalidate that metadata."); 584 } 585 } catch (ParseException e) { 586 LOG.error("Cannot parse date of " + desc + " Error:" + e); 587 } 588 } 589 } 590 591 // private void checkCommentAge(Comment desc, Principal principal) throws DeleteFailedException { 592 // if (isPublic() && !configuration.isAdminUser(principal)) { 593 // try { 594 // Date regDate = Comment.getDate(desc.getCommentDate()); 595 // Calendar calendar = Calendar.getInstance(); 596 // calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); 597 // if (regDate.before(calendar.getTime())) { // More then month old 598 // throw new DeleteFailedException( 599 // "The " 600 // + (desc.getId()) 601 // + " is more then a month old and cannot be deleted anymore."); 602 // } 603 // } catch (ParseException e) { 604 // LOG.error("Cannot parse date of " + desc + " Error:" + e); 605 // } 606 // } 607 // } 454 608 455 609 private boolean inWorkspace(AbstractDescriptionDao<?> dao, String cmdId) { 456 if (isPublic()) { 457 return dao.isPublic(cmdId); 458 } else { 459 return dao.isInUserSpace(cmdId, getUserId()); 460 } 461 } 610 if (isPublic()) { 611 return dao.isPublic(cmdId); 612 } else { 613 return dao.isInUserSpace(cmdId, getUserId()); 614 } 615 } 616 617 // private boolean inWorkspace(CommentsDao dao, String cmdId) { 618 // if (isPublic()) { 619 // return dao.isPublic(cmdId); 620 // } else { 621 // return dao.isInUserSpace(cmdId, getUserId()); 622 // } 623 // } 462 624 463 625 @Override 464 626 public String getName() { 465 466 467 468 469 627 if (isPublic()) { 628 return ComponentRegistry.PUBLIC_NAME; 629 } else { 630 return "User " + getUserId() + " Registry"; 631 } 470 632 } 471 633 472 634 @Override 473 635 public List<ProfileDescription> getDeletedProfileDescriptions() { 474 636 return profileDescriptionDao.getDeletedDescriptions(getUserId()); 475 637 } 476 638 477 639 @Override 478 640 public List<ComponentDescription> getDeletedComponentDescriptions() { 479 641 return componentDescriptionDao.getDeletedDescriptions(getUserId()); 480 642 } 481 643 } -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r1604 r1631 41 41 import clarin.cmdi.componentregistry.components.CMDComponentSpec; 42 42 import clarin.cmdi.componentregistry.model.AbstractDescription; 43 import clarin.cmdi.componentregistry.model.CommentMapping.Comment; 43 44 import clarin.cmdi.componentregistry.model.ComponentDescription; 44 45 import clarin.cmdi.componentregistry.model.ProfileDescription; … … 69 70 70 71 private ComponentRegistry getRegistry(boolean userspace) { 71 72 73 72 Principal userPrincipal = security.getUserPrincipal(); 73 UserCredentials userCredentials = getUserCredentials(userPrincipal); 74 return getRegistry(userspace, userCredentials); 74 75 } 75 76 76 77 private ComponentRegistry getRegistry(boolean userspace, UserCredentials userCredentials) { 77 78 return componentRegistryFactory.getComponentRegistry(userspace, userCredentials); 78 79 } 79 80 80 81 private Principal checkAndGetUserPrincipal() { 81 82 83 84 85 82 Principal principal = security.getUserPrincipal(); 83 if (principal == null) { 84 throw new IllegalArgumentException("no user principal found."); 85 } 86 return principal; 86 87 } 87 88 88 89 private UserCredentials getUserCredentials(Principal userPrincipal) { 89 90 91 92 93 90 UserCredentials userCredentials = null; 91 if (userPrincipal != null) { 92 userCredentials = new UserCredentials(userPrincipal); 93 } 94 return userCredentials; 94 95 } 95 96 … … 98 99 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 99 100 public List<ComponentDescription> getRegisteredComponents(@QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 100 101 102 103 104 101 long start = System.currentTimeMillis(); 102 List<ComponentDescription> components = getRegistry(userspace).getComponentDescriptions(); 103 LOG.info("Releasing " + components.size() + " registered components into the world (" + (System.currentTimeMillis() - start) 104 + " millisecs)"); 105 return components; 105 106 } 106 107 … … 109 110 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 110 111 public List<ProfileDescription> getRegisteredProfiles(@QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace, 111 112 113 114 115 116 117 118 119 120 121 122 123 112 @QueryParam(METADATA_EDITOR_PARAM) @DefaultValue("false") boolean metadataEditor) throws ComponentRegistryException { 113 long start = System.currentTimeMillis(); 114 115 List<ProfileDescription> profiles; 116 if (metadataEditor) { 117 profiles = getRegistry(userspace).getProfileDescriptionsForMetadaEditor(); 118 } else { 119 profiles = getRegistry(userspace).getProfileDescriptions(); 120 } 121 122 LOG.info("Releasing " + profiles.size() + " registered profiles into the world (" + (System.currentTimeMillis() - start) 123 + " millisecs)"); 124 return profiles; 124 125 } 125 126 … … 128 129 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 129 130 public CMDComponentSpec getRegisteredComponent(@PathParam("componentId") String componentId, 130 131 132 131 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 132 LOG.info("Component with id: " + componentId + " is requested."); 133 return getRegistry(userspace).getMDComponent(componentId); 133 134 } 134 135 … … 137 138 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML}) 138 139 public Response getRegisteredComponentRawType(@PathParam("componentId") final String componentId, @PathParam("rawType") String rawType) { 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 140 LOG.info("Component with id: " + componentId + " and rawType:" + rawType + " is requested."); 141 StreamingOutput result = null; 142 try { 143 final ComponentRegistry registry = findRegistry(componentId, new ComponentClosure()); 144 if (registry == null) { 145 return Response.status(Status.NOT_FOUND).entity("Id: " + componentId + " is not registered, cannot create data.").build(); 146 } 147 ComponentDescription desc = registry.getComponentDescription(componentId); 148 checkAndThrowDescription(desc, componentId); 149 String fileName = desc.getName() + "." + rawType; 150 if ("xml".equalsIgnoreCase(rawType)) { 151 result = new StreamingOutput() { 152 153 @Override 154 public void write(OutputStream output) throws IOException, WebApplicationException { 155 try { 156 registry.getMDComponentAsXml(componentId, output); 157 } catch (ComponentRegistryException e) { 158 LOG.info("Could not retrieve component", e); 159 throw new WebApplicationException(e, Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build()); 160 } 161 } 162 }; 163 } else if ("xsd".equalsIgnoreCase(rawType)) { 164 result = new StreamingOutput() { 165 166 @Override 167 public void write(OutputStream output) throws IOException, WebApplicationException { 168 try { 169 registry.getMDComponentAsXsd(componentId, output); 170 } catch (ComponentRegistryException e) { 171 LOG.info("Could not retrieve component", e); 172 throw new WebApplicationException(e, Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build()); 173 } 174 175 } 176 }; 177 } else { 178 throw new WebApplicationException(Response.serverError().entity( 179 "unsupported rawType: " + rawType + " (only xml or xsd are supported)").build()); 180 } 181 return createDownloadResponse(result, fileName); 182 } catch (ComponentRegistryException e) { 183 LOG.info("Could not retrieve component", e); 184 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 185 } 185 186 } 186 187 187 188 public ComponentRegistry findRegistry(String id, RegistryClosure<? extends AbstractDescription> clos) throws ComponentRegistryException { 188 189 190 191 192 193 194 195 196 197 198 199 200 201 189 AbstractDescription desc = null; 190 ComponentRegistry result = getRegistry(false); 191 desc = clos.getDescription(result, id); 192 if (desc == null) { 193 List<ComponentRegistry> userRegs = componentRegistryFactory.getAllUserRegistries(); 194 for (ComponentRegistry reg : userRegs) { 195 desc = clos.getDescription(reg, id); 196 if (desc != null) { 197 result = reg; 198 break; 199 } 200 } 201 } 202 return result; 202 203 } 203 204 … … 206 207 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 207 208 public CMDComponentSpec getRegisteredProfile(@PathParam("profileId") String profileId, 208 209 210 209 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 210 LOG.info("Profile with id: " + profileId + " is requested."); 211 return getRegistry(userspace).getMDProfile(profileId); 211 212 } 212 213 … … 215 216 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 216 217 public List<AbstractDescription> getComponentUsage(@PathParam("componentId") String componentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("true") boolean userspace) throws ComponentRegistryException { 217 try { 218 final long start = System.currentTimeMillis(); 219 ComponentRegistry registry = getRegistry(userspace); 220 List<ComponentDescription> components = registry.getUsageInComponents(componentId); 221 List<ProfileDescription> profiles = registry.getUsageInProfiles(componentId); 222 223 LOG.info("Found " + components.size() + " components and " + profiles.size() + " profiles that use component " + componentId 224 + " (" + (System.currentTimeMillis() - start) + " millisecs)"); 225 226 List<AbstractDescription> usages = new ArrayList<AbstractDescription>(components.size() + profiles.size()); 227 usages.addAll(components); 228 usages.addAll(profiles); 229 230 return usages; 231 } catch (ComponentRegistryException e) { 232 LOG.info("Could not retrieve profile usage", e); 233 throw e; 234 } 218 try { 219 final long start = System.currentTimeMillis(); 220 ComponentRegistry registry = getRegistry(userspace); 221 List<ComponentDescription> components = registry.getUsageInComponents(componentId); 222 List<ProfileDescription> profiles = registry.getUsageInProfiles(componentId); 223 224 LOG.info("Found " + components.size() + " components and " + profiles.size() + " profiles that use component " + componentId 225 + " (" + (System.currentTimeMillis() - start) + " millisecs)"); 226 227 List<AbstractDescription> usages = new ArrayList<AbstractDescription>(components.size() + profiles.size()); 228 usages.addAll(components); 229 usages.addAll(profiles); 230 231 return usages; 232 } catch (ComponentRegistryException e) { 233 LOG.info("Could not retrieve profile usage", e); 234 throw e; 235 } 236 } 237 238 @GET 239 @Path("/profile/{profileId}/comments") 240 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 241 public List<Comment> getRegisteredCommentsFromProfile(@PathParam("profileId") String profileId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 242 long start = System.currentTimeMillis(); 243 List<Comment> comments = getRegistry(userspace).getCommentsInProfile(profileId); 244 LOG.info("Releasing " + comments.size() + " registered comments in Profile into the world (" + (System.currentTimeMillis() - start) 245 + " millisecs)"); 246 return comments; 247 } 248 249 @GET 250 @Path("/component/{componentId}/comments") 251 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 252 public List<Comment> getRegisteredCommentsFromComponent(@PathParam("componentId") String componentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 253 long start = System.currentTimeMillis(); 254 List<Comment> comments = getRegistry(userspace).getCommentsInComponent(componentId); 255 LOG.info("Releasing " + comments.size() + " registered comments in Component into the world (" + (System.currentTimeMillis() - start) 256 + " millisecs)"); 257 return comments; 258 } 259 260 @GET 261 @Path("/profiles/{profileId}/comments/{commentsId}") 262 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 263 public Comment getSpecifiedCommentFromProfile(@PathParam("commentId") String commentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 264 long start = System.currentTimeMillis(); 265 LOG.info(" Comments of component with id" + commentId + " are requested."); 266 return getRegistry(userspace).getSpecifiedCommentInProfile(commentId); 267 } 268 269 @GET 270 @Path("/component/{componentId}/comments/{commentsId}") 271 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 272 public Comment getRegisteredCommentFromComponent(@PathParam("commentId") String commentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 273 LOG.info(" Comments of component with id" + commentId + " are requested."); 274 return getRegistry(userspace).getSpecifiedCommentInComponent(commentId); 235 275 } 236 276 … … 246 286 @Path("/profiles/{profileId}") 247 287 public Response manipulateRegisteredProfile(@PathParam("profileId") String profileId, @FormParam("method") String method, 248 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 249 if ("delete".equalsIgnoreCase(method)) { 250 return deleteRegisteredProfile(profileId, userspace); 251 } else { 252 return Response.ok().build(); 253 } 254 } 288 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 289 if ("delete".equalsIgnoreCase(method)) { 290 return deleteRegisteredProfile(profileId, userspace); 291 } else { 292 return Response.ok().build(); 293 } 294 } 295 296 // @POST 297 // @Path("/profiles/{profileId}/comments/{commentId}") 298 // public Response manipulateRegisteredCommentFromProfile(@PathParam("profileId") String commentId, @FormParam("method") String method, 299 // @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 300 // if ("delete".equalsIgnoreCase(method)) { 301 // return deleteRegisteredProfile(commentId, userspace); 302 // } else { 303 // return Response.ok().build(); 304 // } 305 // } 306 // 307 // @POST 308 // @Path("/components/{componentId}/comments/{commentId}") 309 // public Response manipulateRegisteredCommentFromComponent(@PathParam("profileId") String commentId, @FormParam("method") String method, 310 // @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 311 // if ("delete".equalsIgnoreCase(method)) { 312 // return deleteRegisteredProfile(commentId, userspace); 313 // } else { 314 // return Response.ok().build(); 315 // } 316 // } 255 317 256 318 @POST … … 258 320 @Consumes("multipart/form-data") 259 321 public Response publishRegisteredProfile(@PathParam("profileId") String profileId, @FormDataParam(DATA_FORM_FIELD) InputStream input, 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 322 @FormDataParam(NAME_FORM_FIELD) String name, @FormDataParam(DESCRIPTION_FORM_FIELD) String description, 323 @FormDataParam(GROUP_FORM_FIELD) String group, @FormDataParam(DOMAIN_FORM_FIELD) String domainName) { 324 Principal principal = checkAndGetUserPrincipal(); 325 try { 326 ProfileDescription desc = getRegistry(true).getProfileDescription(profileId); 327 if (desc != null) { 328 updateDescription(desc, name, description, domainName, group); 329 return register(input, desc, getUserCredentials(principal), true, new PublishAction(principal)); 330 } else { 331 LOG.error("Update of nonexistent id (" + profileId + ") failed."); 332 return Response.serverError().entity("Invalid id, cannot update nonexistent profile").build(); 333 } 334 } catch (ComponentRegistryException e) { 335 LOG.info("Could not retrieve component", e); 336 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 337 } 276 338 } 277 339 … … 280 342 @Consumes("multipart/form-data") 281 343 public Response updateRegisteredProfile(@PathParam("profileId") String profileId, 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 344 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace, @FormDataParam(DATA_FORM_FIELD) InputStream input, 345 @FormDataParam(NAME_FORM_FIELD) String name, @FormDataParam(DESCRIPTION_FORM_FIELD) String description, 346 @FormDataParam(GROUP_FORM_FIELD) String group, @FormDataParam(DOMAIN_FORM_FIELD) String domainName) { 347 Principal principal = checkAndGetUserPrincipal(); 348 UserCredentials userCredentials = getUserCredentials(principal); 349 try { 350 ProfileDescription desc = getRegistry(userspace).getProfileDescription(profileId); 351 if (desc != null) { 352 updateDescription(desc, name, description, domainName, group); 353 return register(input, desc, userCredentials, userspace, new UpdateAction(principal)); 354 } else { 355 LOG.error("Update of nonexistent id (" + profileId + ") failed."); 356 return Response.serverError().entity("Invalid id, cannot update nonexistent profile").build(); 357 } 358 } catch (ComponentRegistryException e) { 359 LOG.info("Could not retrieve component", e); 360 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 361 } 300 362 } 301 363 … … 311 373 @Path("/components/{componentId}") 312 374 public Response manipulateRegisteredComponent(@PathParam("componentId") String componentId, @FormParam("method") String method, 313 314 315 316 317 318 375 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 376 if ("delete".equalsIgnoreCase(method)) { 377 return deleteRegisteredComponent(componentId, userspace); 378 } else { 379 return Response.ok().build(); 380 } 319 381 } 320 382 … … 323 385 @Consumes("multipart/form-data") 324 386 public Response publishRegisteredComponent(@PathParam("componentId") String componentId, 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 387 @FormDataParam(DATA_FORM_FIELD) InputStream input, @FormDataParam(NAME_FORM_FIELD) String name, 388 @FormDataParam(DESCRIPTION_FORM_FIELD) String description, @FormDataParam(GROUP_FORM_FIELD) String group, 389 @FormDataParam(DOMAIN_FORM_FIELD) String domainName) { 390 Principal principal = checkAndGetUserPrincipal(); 391 try { 392 ComponentDescription desc = getRegistry(true).getComponentDescription(componentId); 393 if (desc != null) { 394 updateDescription(desc, name, description, domainName, group); 395 return register(input, desc, getUserCredentials(principal), true, new PublishAction(principal)); 396 } else { 397 LOG.error("Update of nonexistent id (" + componentId + ") failed."); 398 return Response.serverError().entity("Invalid id, cannot update nonexistent profile").build(); 399 } 400 } catch (ComponentRegistryException e) { 401 LOG.info("Could not retrieve component", e); 402 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 403 } 342 404 } 343 405 … … 346 408 @Consumes("multipart/form-data") 347 409 public Response updateRegisteredComponent(@PathParam("componentId") String componentId, 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 410 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace, @FormDataParam(DATA_FORM_FIELD) InputStream input, 411 @FormDataParam(NAME_FORM_FIELD) String name, @FormDataParam(DESCRIPTION_FORM_FIELD) String description, 412 @FormDataParam(GROUP_FORM_FIELD) String group, @FormDataParam(DOMAIN_FORM_FIELD) String domainName) { 413 Principal principal = checkAndGetUserPrincipal(); 414 try { 415 ComponentDescription desc = getRegistry(userspace).getComponentDescription(componentId); 416 if (desc != null) { 417 updateDescription(desc, name, description, domainName, group); 418 return register(input, desc, getUserCredentials(principal), userspace, new UpdateAction(principal)); 419 } else { 420 LOG.error("Update of nonexistent id (" + componentId + ") failed."); 421 return Response.serverError().entity("Invalid id, cannot update nonexistent component").build(); 422 } 423 } catch (ComponentRegistryException e) { 424 LOG.info("Could not retrieve component", e); 425 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 426 } 365 427 } 366 428 367 429 private void updateDescription(AbstractDescription desc, String name, String description, String domainName, String group) { 368 369 370 371 372 430 desc.setName(name); 431 desc.setDescription(description); 432 desc.setDomainName(domainName); 433 desc.setGroupName(group); 434 desc.setRegistrationDate(AbstractDescription.createNewDate()); 373 435 } 374 436 … … 376 438 @Path("/components/{componentId}") 377 439 public Response deleteRegisteredComponent(@PathParam("componentId") String componentId, 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 440 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 441 Principal principal = checkAndGetUserPrincipal(); 442 ComponentRegistry registry = getRegistry(userspace); 443 LOG.info("Component with id: " + componentId + " set for deletion."); 444 try { 445 registry.deleteMDComponent(componentId, principal, false); 446 } catch (DeleteFailedException e) { 447 LOG.info("Component with id: " + componentId + " deletion failed.", e); 448 return Response.status(Status.FORBIDDEN).entity("" + e.getMessage()).build(); 449 } catch (ComponentRegistryException e) { 450 LOG.info("Component with id: " + componentId + " deletion failed.", e); 451 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 452 } catch (IOException e) { 453 LOG.info("Component with id: " + componentId + " deletion failed.", e); 454 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 455 } catch (UserUnauthorizedException e) { 456 LOG.info("Component with id: " + componentId + " deletion failed: " + e.getMessage()); 457 return Response.serverError().status(Status.UNAUTHORIZED).entity("" + e.getMessage()).build(); 458 } 459 LOG.info("Component with id: " + componentId + " deleted."); 460 return Response.ok().build(); 399 461 } 400 462 … … 402 464 @Path("/profiles/{profileId}") 403 465 public Response deleteRegisteredProfile(@PathParam("profileId") String profileId, 404 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 405 Principal principal = checkAndGetUserPrincipal(); 406 LOG.info("Profile with id: " + profileId + " set for deletion."); 407 try { 408 getRegistry(userspace).deleteMDProfile(profileId, principal); 409 } catch (DeleteFailedException e) { 410 LOG.info("Profile with id: " + profileId + " deletion failed: " + e.getMessage()); 411 return Response.serverError().status(Status.FORBIDDEN).entity("" + e.getMessage()).build(); 412 } catch (ComponentRegistryException e) { 413 LOG.info("Could not retrieve component", e); 414 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 415 } catch (IOException e) { 416 LOG.info("Profile with id: " + profileId + " deletion failed.", e); 417 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 418 } catch (UserUnauthorizedException e) { 419 LOG.info("Profile with id: " + profileId + " deletion failed: " + e.getMessage()); 420 return Response.serverError().status(Status.UNAUTHORIZED).entity("" + e.getMessage()).build(); 421 } 422 LOG.info("Profile with id: " + profileId + " deleted."); 423 return Response.ok().build(); 424 } 466 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 467 Principal principal = checkAndGetUserPrincipal(); 468 LOG.info("Profile with id: " + profileId + " set for deletion."); 469 try { 470 getRegistry(userspace).deleteMDProfile(profileId, principal); 471 } catch (DeleteFailedException e) { 472 LOG.info("Profile with id: " + profileId + " deletion failed: " + e.getMessage()); 473 return Response.serverError().status(Status.FORBIDDEN).entity("" + e.getMessage()).build(); 474 } catch (ComponentRegistryException e) { 475 LOG.info("Could not retrieve component", e); 476 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 477 } catch (IOException e) { 478 LOG.info("Profile with id: " + profileId + " deletion failed.", e); 479 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 480 } catch (UserUnauthorizedException e) { 481 LOG.info("Profile with id: " + profileId + " deletion failed: " + e.getMessage()); 482 return Response.serverError().status(Status.UNAUTHORIZED).entity("" + e.getMessage()).build(); 483 } 484 LOG.info("Profile with id: " + profileId + " deleted."); 485 return Response.ok().build(); 486 } 487 488 // @DELETE 489 // @Path("/profiles/{profileId}/comments/{commentId}") 490 // public Response deleteRegisteredCommentFromProfile(@PathParam("commentId") String commentId, 491 // @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 492 // Principal principal = checkAndGetUserPrincipal(); 493 // LOG.info("Comment with id: " + commentId + " set for deletion."); 494 // try { 495 // getRegistry(userspace).deleteMDComment(commentId, principal); 496 // } catch (DeleteFailedException e) { 497 // LOG.info("Comment with id: " + commentId + " deletion failed: " + e.getMessage()); 498 // return Response.serverError().status(Status.FORBIDDEN).entity("" + e.getMessage()).build(); 499 // } catch (ComponentRegistryException e) { 500 // LOG.info("Could not retrieve component", e); 501 // return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 502 // } catch (IOException e) { 503 // LOG.info("Comment with id: " + commentId + " deletion failed.", e); 504 // return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 505 // } catch (UserUnauthorizedException e) { 506 // LOG.info("Comment with id: " + commentId + " deletion failed: " + e.getMessage()); 507 // return Response.serverError().status(Status.UNAUTHORIZED).entity("" + e.getMessage()).build(); 508 // } 509 // LOG.info("Profile with id: " + commentId + " deleted."); 510 // return Response.ok().build(); 511 // } 512 // 513 // @DELETE 514 // @Path("/components/{componentId}/comments/{commentId}") 515 // public Response deleteRegisteredCommentFromComponent(@PathParam("commentId") String commentId, 516 // @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 517 // Principal principal = checkAndGetUserPrincipal(); 518 // LOG.info("Comment with id: " + commentId + " set for deletion."); 519 // try { 520 // getRegistry(userspace).deleteMDComment(commentId, principal); 521 // } catch (DeleteFailedException e) { 522 // LOG.info("Comment with id: " + commentId + " deletion failed: " + e.getMessage()); 523 // return Response.serverError().status(Status.FORBIDDEN).entity("" + e.getMessage()).build(); 524 // } catch (ComponentRegistryException e) { 525 // LOG.info("Could not retrieve component", e); 526 // return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 527 // } catch (IOException e) { 528 // LOG.info("Comment with id: " + commentId + " deletion failed.", e); 529 // return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 530 // } catch (UserUnauthorizedException e) { 531 // LOG.info("Comment with id: " + commentId + " deletion failed: " + e.getMessage()); 532 // return Response.serverError().status(Status.UNAUTHORIZED).entity("" + e.getMessage()).build(); 533 // } 534 // LOG.info("Profile with id: " + commentId + " deleted."); 535 // return Response.ok().build(); 536 // } 425 537 426 538 @GET … … 428 540 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML}) 429 541 public Response getRegisteredProfileRawType(@PathParam("profileId") final String profileId, @PathParam("rawType") String rawType) { 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 542 LOG.info("Profile with id: " + profileId + " and rawType:" + rawType + " is requested."); 543 StreamingOutput result = null; 544 try { 545 final ComponentRegistry registry = findRegistry(profileId, new ProfileClosure()); 546 if (registry == null) { 547 return Response.status(Status.NOT_FOUND).entity("Id: " + profileId + " is not registered, cannot create data.").build(); 548 } 549 ProfileDescription desc = registry.getProfileDescription(profileId); 550 checkAndThrowDescription(desc, profileId); 551 String fileName = desc.getName() + "." + rawType; 552 553 if ("xml".equalsIgnoreCase(rawType)) { 554 result = new StreamingOutput() { 555 556 @Override 557 public void write(OutputStream output) throws IOException, WebApplicationException { 558 try { 559 registry.getMDProfileAsXml(profileId, output); 560 } catch (ComponentRegistryException e) { 561 LOG.warn("Could not retrieve component", e); 562 throw new WebApplicationException(e, Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build()); 563 } 564 } 565 }; 566 } else if ("xsd".equalsIgnoreCase(rawType)) { 567 result = new StreamingOutput() { 568 569 @Override 570 public void write(OutputStream output) throws IOException, WebApplicationException { 571 try { 572 registry.getMDProfileAsXsd(profileId, output); 573 } catch (ComponentRegistryException e) { 574 LOG.warn("Could not retrieve component", e); 575 throw new WebApplicationException(e, Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build()); 576 } 577 } 578 }; 579 } else { 580 throw new WebApplicationException(Response.serverError().entity( 581 "unsupported rawType: " + rawType + " (only xml or xsd are supported)").build()); 582 } 583 return createDownloadResponse(result, fileName); 584 } catch (ComponentRegistryException e) { 585 LOG.info("Could not retrieve component", e); 586 return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); 587 } 476 588 } 477 589 478 590 private void checkAndThrowDescription(AbstractDescription desc, String id) { 479 480 481 591 if (desc == null) { 592 throw new WebApplicationException(Response.serverError().entity("Incorrect id:" + id + "cannot handle request").build()); 593 } 482 594 } 483 595 484 596 private Response createDownloadResponse(StreamingOutput result, String fileName) { 485 486 487 488 597 //Making response so it triggers browsers native save as dialog. 598 Response response = Response.ok().type("application/x-download").header("Content-Disposition", 599 "attachment; filename=\"" + fileName + "\"").entity(result).build(); 600 return response; 489 601 490 602 } … … 495 607 @Consumes("multipart/form-data") 496 608 public Response registerProfile(@FormDataParam(DATA_FORM_FIELD) InputStream input, @FormDataParam(NAME_FORM_FIELD) String name, 497 498 499 500 501 502 503 504 505 506 507 508 509 609 @FormDataParam(DESCRIPTION_FORM_FIELD) String description, @FormDataParam(GROUP_FORM_FIELD) String group, @FormDataParam(DOMAIN_FORM_FIELD) String domainName, 610 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 611 Principal principal = checkAndGetUserPrincipal(); 612 UserCredentials userCredentials = getUserCredentials(principal); 613 ProfileDescription desc = createNewProfileDescription(); 614 desc.setCreatorName(userCredentials.getDisplayName()); 615 desc.setUserId(userCredentials.getPrincipalName()); // Hash used to be created here, now Id is constructed by impl 616 desc.setName(name); 617 desc.setDescription(description); 618 desc.setGroupName(group); 619 desc.setDomainName(domainName); 620 LOG.info("Trying to register Profile: " + desc); 621 return register(input, desc, userCredentials, userspace, new NewAction()); 510 622 } 511 623 … … 515 627 @Consumes("multipart/form-data") 516 628 public Response registerComponent(@FormDataParam(DATA_FORM_FIELD) InputStream input, @FormDataParam(NAME_FORM_FIELD) String name, 517 518 519 520 521 522 523 524 525 526 527 528 529 629 @FormDataParam(DESCRIPTION_FORM_FIELD) String description, @FormDataParam(GROUP_FORM_FIELD) String group, 630 @FormDataParam(DOMAIN_FORM_FIELD) String domainName, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 631 Principal principal = checkAndGetUserPrincipal(); 632 UserCredentials userCredentials = getUserCredentials(principal); 633 ComponentDescription desc = createNewComponentDescription(); 634 desc.setCreatorName(userCredentials.getDisplayName()); 635 desc.setUserId(userCredentials.getPrincipalName()); // Hash used to be created here, now Id is constructed by impl 636 desc.setName(name); 637 desc.setDescription(description); 638 desc.setGroupName(group); 639 desc.setDomainName(domainName); 640 LOG.info("Trying to register Component: " + desc); 641 return register(input, desc, userCredentials, userspace, new NewAction()); 530 642 } 531 643 … … 534 646 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 535 647 public Response pingSession() { 536 537 538 539 540 541 542 543 544 648 boolean stillActive = false; 649 Principal userPrincipal = security.getUserPrincipal(); 650 LOG.info("ping by user: " + (userPrincipal == null ? "null" : userPrincipal.getName())); 651 if (request != null) { 652 if (userPrincipal != null && !ComponentRegistryFactory.ANONYMOUS_USER.equals(userPrincipal.getName())) { 653 stillActive = !((HttpServletRequest) request).getSession().isNew(); 654 } 655 } 656 return Response.ok().entity("<session stillActive=\"" + stillActive + "\"/>").build(); 545 657 } 546 658 547 659 private Response register(InputStream input, AbstractDescription desc, UserCredentials userCredentials, boolean userspace, 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 660 RegisterAction action) { 661 try { 662 ComponentRegistry registry = getRegistry(userspace, userCredentials); 663 DescriptionValidator descriptionValidator = new DescriptionValidator(desc); 664 MDValidator validator = new MDValidator(input, desc, registry, getRegistry(true), componentRegistryFactory.getPublicRegistry()); 665 RegisterResponse response = new RegisterResponse(); 666 response.setIsInUserSpace(userspace); 667 validate(response, descriptionValidator, validator); 668 if (response.getErrors().isEmpty()) { 669 CMDComponentSpec spec = validator.getCMDComponentSpec(); 670 int returnCode = action.execute(desc, spec, response, registry); 671 if (returnCode == 0) { 672 response.setRegistered(true); 673 response.setDescription(desc); 674 } else { 675 response.setRegistered(false); 676 response.addError("Unable to register at this moment. Internal server error."); 677 } 678 } else { 679 LOG.info("Registration failed with validation errors:" + Arrays.toString(response.getErrors().toArray())); 680 response.setRegistered(false); 681 } 682 response.setIsProfile(desc.isProfile()); 683 return Response.ok(response).build(); 684 } finally { 685 try { 686 input.close();//either we read the input or there was an exception, we need to close it. 687 } catch (IOException e) { 688 LOG.error("Error when closing inputstream: ", e); 689 } 690 } 579 691 } 580 692 581 693 private ComponentDescription createNewComponentDescription() { 582 583 584 694 ComponentDescription desc = ComponentDescription.createNewDescription(); 695 desc.setHref(createXlink(desc.getId())); 696 return desc; 585 697 } 586 698 587 699 private ProfileDescription createNewProfileDescription() { 588 589 590 700 ProfileDescription desc = ProfileDescription.createNewDescription(); 701 desc.setHref(createXlink(desc.getId())); 702 return desc; 591 703 } 592 704 593 705 private String createXlink(String id) { 594 595 706 URI uri = uriInfo.getRequestUriBuilder().path(id).build(); 707 return uri.toString(); 596 708 } 597 709 598 710 private void validate(RegisterResponse response, Validator... validators) { 599 600 601 602 603 604 605 711 for (Validator validator : validators) { 712 if (!validator.validate()) { 713 for (String error : validator.getErrorMessages()) { 714 response.addError(error); 715 } 716 } 717 } 606 718 } 607 719 … … 610 722 */ 611 723 public void setComponentRegistryFactory(ComponentRegistryFactory componentRegistryFactory) { 612 724 this.componentRegistryFactory = componentRegistryFactory; 613 725 } 614 726 } -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/sql/create.sql
r1602 r1631 20 20 -- 21 21 22 CREATE TABLE comments ( 23 id SERIAL NOT NULL, 24 profile_description_id integer, 25 component_description_id integer, 26 user_id integer, 27 comments text NOT NULL 22 CREATE TABLE comments 23 ( 24 comment_id integer NOT NULL DEFAULT nextval('comments_id_seq'::regclass), 25 comments text NOT NULL, 26 comment_date timestamp with time zone, 27 profile_description_id character varying, 28 component_description_id character varying, 29 user_id integer 30 28 31 ); 29 32 … … 93 96 94 97 -- 98 -- Name: comments_id_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 99 -- 100 101 ALTER TABLE ONLY comments 102 ADD CONSTRAINT comments_id_pkey PRIMARY KEY(id); 103 104 -- 95 105 -- Name: component_description_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 96 106 -- … … 132 142 CREATE INDEX fki_comments_profile ON comments USING btree (profile_description_id); 133 143 144 -- 145 -- Name: fki_comments_component; Type: INDEX; Schema: public; Owner: -; Tablespace: 146 -- 147 148 CREATE INDEX fki_comments_component ON comments USING btree (component_description_id); 149 134 150 135 151 -- … … 166 182 167 183 ALTER TABLE ONLY comments 168 ADD CONSTRAINT comments_profile FOREIGN KEY (profile_description_id) REFERENCES profile_description( id);184 ADD CONSTRAINT comments_profile FOREIGN KEY (profile_description_id) REFERENCES profile_description(profile_id); 169 185 170 186 … … 175 191 ALTER TABLE ONLY comments 176 192 ADD CONSTRAINT comments_user FOREIGN KEY (user_id) REFERENCES registry_user(id); 193 194 195 -- 196 -- Name: comments_component; Type: FK CONSTRAINT; Schema: public; Owner: - 197 -- 198 199 ALTER TABLE ONLY comments 200 ADD CONSTRAINT comments_component FOREIGN KEY (component_description_id) REFERENCES component_description(component_id); 177 201 178 202 -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/webresources/WEB-INF/spring-config/persistence.xml
r1361 r1631 20 20 <property name="dataSource" ref="dataSource"/> 21 21 </bean> 22 <bean id="commentsDao" class="clarin.cmdi.componentregistry.impl.database.CommentsDao"> 23 <property name="dataSource" ref="dataSource"/> 24 </bean> 22 25 23 26 </beans> -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryTestDatabase.java
r1603 r1631 27 27 + " description character varying NOT NULL," 28 28 + " registration_date timestamp,"// with timezone," 29 29 + " href character varying," 30 30 + " creator_name character varying," 31 31 + " domain_name character varying," … … 44 44 + " description character varying NOT NULL," 45 45 + " registration_date timestamp,"// with timezone," 46 46 + " href character varying," 47 47 + " creator_name character varying," 48 48 + " domain_name character varying," 49 49 + " group_name character varying, " 50 51 50 + " show_in_editor boolean DEFAULT true NOT NULL, " 51 + " CONSTRAINT UNIQUE_PROFILE_ID UNIQUE (profile_id));"); 52 52 } 53 53 … … 64 64 } 65 65 66 public static void createTableComments(JdbcTemplate jdbcTemplate) { 67 jdbcTemplate.execute("CREATE TABLE comments (" 68 + "id IDENTITY NOT NULL," 69 + "user_id integer," 70 + " profile_description_id character varying," 71 + " component_description_id character varying," 72 + " comments character varying NOT NULL," 73 + " comment_date timestamp," 74 + " CONSTRAINT UNIQUE_COMMENTS_ID UNIQUE (id));"); 75 } 76 66 77 public static void resetAndCreateAllTables(JdbcTemplate jdbcTemplate) { 67 resetDatabase(jdbcTemplate); 68 createTableComponentDescription(jdbcTemplate); 69 createTableProfileDescription(jdbcTemplate); 70 createTableXmlContent(jdbcTemplate); 71 createTableRegistryUser(jdbcTemplate); 78 resetDatabase(jdbcTemplate); 79 createTableComponentDescription(jdbcTemplate); 80 createTableProfileDescription(jdbcTemplate); 81 createTableXmlContent(jdbcTemplate); 82 createTableRegistryUser(jdbcTemplate); 83 createTableComments(jdbcTemplate); 72 84 } 73 85 } -
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/test/resources/spring-config/persistence.xml
r1361 r1631 20 20 <property name="dataSource" ref="dataSource"/> 21 21 </bean> 22 <bean id="commentsDao" class="clarin.cmdi.componentregistry.impl.database.CommentsDao"> 23 <property name="dataSource" ref="dataSource"/> 24 </bean> 22 25 23 26 </beans> -
ComponentRegistry/branches/jeaferversion/pom.xml
r1568 r1631 24 24 <ComponentRegistry.version>1.10.0-SNAPSHOT</ComponentRegistry.version> 25 25 </properties> 26 27 <repositories> 28 <repository> 29 <id>cmdi.clarin.repository</id> 30 <name>Clarin Repository</name> 31 <url>http://catalog.clarin.eu/ds/nexus/content/groups/public/</url> 32 </repository> 33 </repositories> 26 34 27 35 <reporting>
Note: See TracChangeset
for help on using the changeset viewer.